@ 2008-03-29
1 IME #Âü°í »çÀÌÆ®;
http://sarangnamu.net/basic/basic_view.php?no=826
http://kr.blog.yahoo.com/ppk314/76884?kbsp=WM_IME_COMPOSITION&kbsref=etc&mp=&mpc=4 http://gfc3.springnote.com/pages/525970 1.1 IME¶õ ¹«¾ùÀΰ¡? #IME¶õ Input Method Editor·Î ±Øµ¿ ¾Æ½Ã¾Æ ¾ð¾îÀÎ Çѱ¹¾î, Áß±¹¾î, ÀϺ»¾îµî DBCS(Double Byte Character Sets) / MDCS(Multi Byte Character Sets)À» ÀÔ·Â ¹Þ´Â ¿¡µðÅ͸¦ ¸»ÇÑ´Ù.
Âü°íÀÚ·á >> http://www.dexgame.com/zbxe/?mid=download&search_target=title&search_keyword=ime&document_srl=5879
´Ù±¹¾î IME ±¸Çö Àç·á (ANSI ¸ðµå »ç¿ë) IME_Test.zip (2006.12.08)...
À̱ÇÀÏ ¾È³çÇϼ¼¿ä. ¸ÅÅ©·Î ¾ø´Â ¸Þºñ~¶ø´Ï´Ù.
´Ù±¹¾î IME ±¸Çö ÀÚ·áÀÔ´Ï´Ù. ¿¾³¯ ÀÚ·á½Ç¿¡ ÀÖ¾ú´Âµ¥ ÀÌÂÊÀ¸·Î ¾à°£ ¼öÁ¤ÇÑ »õ ¹öÁ¯À» ¿Ã¸³´Ï´Ù. ±âº»ÀûÀ¸·Î ANSI ¹öÁ¯¿¡¼ ÀÛµ¿ÇÏ´Â ÄÚµåÀÌ¸ç ´Ù±¹¾î ÀÔ/Ãâ·Â °ü·Ã Äڵ尡 µé¾î ÀÖ½À´Ï´Ù. Composite ¿Í Candidate ´Â GDI¿¡ Á÷Á¢ ±×·ÁÁÖ°í ÀÖÀ¸´Ï ¶â¾î¼ °ÔÀÓ¿¡ º¸¿©ÁÖ½Ã¸é µÇ°í ÆùÆ® Ãâ·ÂºÎºÐÀ» Unicode ·Î ÇÏ°í ÀÖÀ¸³ª ANSI ·Î º¯È¯Çؼ Âï¾îÁּŵµ µË´Ï´Ù. º¯°æ»çÇ×; Vietnam Charset/Codepage ó¸® Ãß°¡ (switch¹®) 1.2 ÀϹÝÀûÀÎ IMEÀÇ µ¿ÀÛ #ÀϹÝÀûÀÎ CWnd¸¦ »ó¼Ó¹Þ¾Æ¼ ¸¸µç À©µµ¿ì´Â ¿µ¹®ÀÚ¸¦ ÀÔ·Â ¹ÞÀ¸·Î WM_KEYDOWN ´ÙÀ½¿¡ WM_CHAR¸Þ¼¼Áö°¡ ¹ß»ýÇÏ°Ô µÇÁö¸¸ ÇѱÛÀÏ °æ¿ì¿¡´Â WM_KEYDOWN ´ÙÀ½¿¡ WM_IME_COMPOSITIONÀÌ ¹ß»ýÇÏ°í ÇѱÛÀÌ ¿Ï¼ºÀÌ µÇ¸é WM_CHARÀÌ µÎ¹ø ¹ß»ýµÇ°Ô µÈ´Ù. ¿Ö µÎ¹øÀ̳ĸé ÇѱÛÀº 2byteÀ̹ǷΠÇѹø¿¡ Àü´ÞÇÒ ¼ö ¾ø±â ¶§¹®ÀÌ´Ù.
ÀÌ·²¶§ÀÇ ¹®Á¦Á¡Àº ÇѱÛ󸮰¡ ÀÚÀ½À̳ª ¸ðÀ½´ÜÀ§·Î ó¸®ÇÒ ¼ö ¾ø°í ±ÛÀÚ´ÜÀ§·Î ó¸®ÇØ¾ß ÇÑ´Ù´Â °ÍÀÌ´Ù.
ÀÌ·± ¹®Á¦¸¦ ÇØ°áÇϱâ À§Çؼ ±âº» IME¿¡¼ ¹ß»ýµÇ´Â ¸Þ¼¼Áö¿¡ ´ëÇÑ Ã³¸®¸¦ ÇÁ·Î±×·¡¸Ó°¡ Á÷Á¢ÇØ¾ß ÇÏ´Â °ÍÀÌ´Ù.
½Ã½ºÅÛ¿¡¼´Â IME À©µµ¿ìÀÇ º¯È/Á¶¸³ ¹®ÀÚ¿ÀÇ º¯È µî IMEÀÇ ¸ðµç »óÅ º¯È¿¡ ´ëÇØ WM_IME ·Î ½ÃÀ۵Ǵ IME ¸Þ½ÃÁö¸¦ Æ÷Ä¿½º À©µµ¿ì¿¡ º¸³½´Ù. ÀÌ ¸Þ½ÃÁöµéÀ» ó¸®ÇÏÁö ¾Ê°í DefWindowProc() À¸·Î º¸³¾ °æ¿ì ÇÁ·Î±×·¥Àº ¿Ï¼ºµÈ ¹®ÀÚ¿¡ ´ëÇؼ¸¸ WM_CHAR ¸Þ½ÃÁö¸¦ ¹Þ°Ô µÈ´Ù.
1.2.1 IME¿¡ °ü·ÃµÈ ÇÔ¼öµé #
1.3 ÇÑ±Û ÀÔ·Â °ü·Ã À©µµ¿ì ¸Þ¼¼Áö #
1.3.1 WM_IME_COMPOSITIONÀÇ ¹ß»ý°ú Ãëµæ ÇÑ±Û ÄÚµå #ÀÌ ºÎºÐÀº ÇѱÛÀ» ÀÔ·Â ÇßÀ»¶§, Áï WM_IME_COMPOSITION ¸Þ¼¼Áö°¡ ¹ß»ýÇßÀ»¶§ IME ¹öÆÛÀÇ ³»¿ëÀ» Ç¥·Î ¸¸µé¾î ³õÀº °ÍÀÌ´Ù.WM_IME_COMPOSITION ¸Þ¼¼Áö´Â Çѱ۸ðµå¿¡¼ ÇѱÛÀÌ ÀÔ·ÂµÇ¸é ¿Ï¼ºÀÌµç ¹Ì¿Ï¼ºÀ̵ç ÀÌ ¸Þ¼¼Áö¸¦ ¹ß»ýÇÏ°Ô µÇ´Âµ¥ lParamÀÇ °ªÀ¸·Î °Ë»çÇؼ ¿Ï¼ºµÈ ±ÛÀÚÀÎÁö ¹Ì ¿Ï¼ºµÈ ±ÛÀÚÀÎÁö ¾Ë¼ö ÀÖ´Ù. ±×¸®°í IME°¡ ÀúÀåÇÏ°í ÀÖ´Â ¹®ÀÚ¿À» Composition ¹®ÀÚ¿À̶ó°í ÇÑ´Ù.
2 CEGUI-SDK-0.5.0b(±âÁØÀ¸·Î Á¤¸®) #Âü°í »çÀÌÆ®
http://www.cegui.org.uk/wiki/index.php/Main_Page - 2008.03.27 CEGUI-SDK-0.6.0-vc8
http://acasia.tistory.com/166 http://cafe.naver.com/ogre3d.cafe - OGRE 3D °ü·Ã Ä«Æä·Î °Ô½Ã¹° Áß¿¡ CEGUI¿¡ °üÇÑ Á¤¸® ÀÖÀ½ CEGUI-SDK-0.5.0b-vc8.exe/ CEImagesetEditor.zip (¹öÀü ?) CELayoutEditorSetup_0.5.0c.exe/ CELayoutEditorSetup-0.5.0b.exe/ 2.1 ÆÄÀÏ ±¸Á¶ #'CEGUI-SDK-0.5.0b-vc8\datafiles\'Æúµå¿¡ ÀúÀåµÈ ´Ù¾çÇÑ ÆÄÀÏÀ» ·ÎµùÇؼ »ç¿ëÇϸç±âº»ÀûÀÎ ±¸Á¶·Î schemes, looknfeel, imagesets, layouts·Î ±¸¼ºµÈ´Ù. 2.1.1 schemes #<xml version="1.0" ?> // xml ¹öÀü<GUIScheme Name="WindowsLookSkin"> // GUIScheme À̸§ <Imageset Name="WindowsLook" Filename="WindowsLook.imageset" /> // ¿¬µ¿µÉ Image Set <LookNFeel Filename="WindowsLook.looknfeel" /> // ¿¬µ¿µÉ LookNFeel <WindowSet Filename="CEGUIFalagardWRBase" /> // ¿¬µ¿µÉ WindowSet <FalagardMapping
WindowType="WindowsLook/Button" // À©µµ¿ì ŸÀÔ
TargetType="CEGUI/PushButton" // Ÿ°Ù ŸÀÔ Renderer="Falagard/Button" // ·»´õ·¯ ŸÀÔ LookNFeel="WindowsLook/Button" /> // LookNFeel 2.1.2 looknfeel #Falagard ½ºÅ²À» ±¸¼ºÇÏ´Â ºÎºÐÀ¸·Î ±âº»ÀûÀÎ ±¸Á¶´Â ´ÙÀ½°ú °°´Ù.<xml version="1.0" ?> <Falagard>
<WidgetLook name="WindowsLook/Button">
</ Falagard>
<PropertyDefinition name="NormalTextColour" initialValue="FF000000" redrawOnWrite="true" /> // ¼Ó¼ºÀ» Á¤ÀÇ
</ WidgetLook>2.1.3 imagesets #À̹ÌÁö¼ÂÀº À̹ÌÁö/ÅؽºÃ³ »óÀÇ Á¤ÀÇµÈ ¿µ¿ªÀÇ ÁýÇÕÀ¸·Î CEImagesetEditor¸¦ ÅëÇؼ ÀÛ¼ºÇÒ ¼ö ÀÖ´Ù.<xml version="1.0" ?> <Imageset Name="WindowsLook" Imagefile="WindowsLook.tga" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"> <Image Name="Background" XPos="9" YPos="9" Width="2" Height="2" /> ... </Imageset> Á¤ÀÇµÈ ¿µ¿µµéÀº ½Ã½ºÅÛ ³»ºÎ¿¡¼ ´ÜÀÏÇÑ À̸§ÀÇ Image·Î »ç¿ëÇÑ´Ù. 2.1.4 layouts #CELayoutEditor¸¦ »ç¿ëÇؼ ·¹À̾ƿôÀ» ÀÛ¼ºÇÒ ¼ö ÀÖ´Ù.<xml version="1.0" ?> <GUILayout>
<Window Type="Vanilla/Button" Name="Vanilla/Console/Submit">
...
<Property Name="ID" Value="1" />
</Window></GUILayout> 2.2 ÇÑ±Û ¼³Á¤ #2.2.1 ÇÑ±Û Ãâ·Â #Ãâó; http://blog.naver.com/dekaf?Redirect=Log&logNo=400412345071.CEGUI 0.5.0ºÎÅÍ´Â ¸î °¡Áö µî·ÏÀ» ÅëÇؼ ÇѱÛÀ» Ãâ·ÂÇÑ´Ù.Àº ¼ø¼·Î µî·ÏÇØ ÁØ´Ù. 1-1.ÇÑ±Û ÆùÆ® µî·Ï
-.»ç¿ëÇÒ ÆùÆ®¸¦ datafiles\fonts¿¡ ³Ö¾îÁØ´Ù.
<xml version="1.0" ?>-.ÇѱÛ.font ÆÄÀÏÀ» ÀÛ¼º <Font Name="Han-12" Filename="H2GTRE.TTF" Type="FreeType" Size="10" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"/> 1-2.ÇÁ·Î±×·¥¿¡¼ ÆùÆ® ·Îµù 1-3.Ãâ·ÂÇÒ ÇѱÛÀ» UTF-8·Î º¯È¯
1) ¼Ò½ºÄÚµå ÀÚü¸¦ UTF-8·Î ÀúÀå; Visual Studio¿¡¼ ¼Ò½ºÄڵ带 ÀúÀåÇÒ ¶§, UTF-8·Î ÀúÀåÇÏ¸é º° ¹®Á¦¾øÀÌ ÇѱÛÀÌ Ãâ·Â
Visual Studio 6.0¿¡¼ ÀúÀåÇü½ÄÀ» ¼³Á¤ÇÒ ¼ö ¾øÀ½
2) Á¤ÀûÀ¸·Î Ãâ·ÂÇÒ ¹®ÀÚµéÀ» UTF-8·Î ÀÎÄÚµå Çؼ File·Î ÀúÀå½ÃÄÑµÎ°í °Å±â¼ ÀÐ¾î¼ Ãâ·ÂVS 2005¿¡¼´Â °í±Þ¿É¼Ç¿¡¼ UTF-8·Î ÀúÀå °¡´É(Á¦´ë·Î µÇÁö ¾Ê´Â´Ù°í ÇÔ) VS 2003¿¡¼´Â Àß µÈ´Ù°í ÇÔ
VS 2005¿¡¼ UTF-8·Î ÀÎÄÚµùµÈ ÆÄÀÏÀ» ÀÐ¾î¼ ÂïÀ¸¸é ÇѱÛÀÌ Àß ³ª¿È
3) MBC ¹®ÀÚ¿À» UTF-8·Î ¸¸µé¾î¼ CEGUI ¸ðµâ·Î º¸³»±â(º¯È¯Àº MBC -> Unicode -> UTF-8 ¼ø¼·Î) Âü°í ÆÄÀÏ(in orge3d ½ºÅ͵ð Ä«Æä) strconv-dekaf.h
#include "strconv.h"
#define CONV_UTF8_MBCS(a) convUni2Mbcs(convUtf82Uni(a)).c_str() #define CONV_MBCS_UTF8(a) convUni2Utf8(convMbcs2Uni(a)).c_str() 2.2.2 ÇÑ±Û ÀÔ·Â1 #Ãâó; http://www.gpgstudy.com/forum/viewtopic.php?topic=15388WM_IME_COMPOSITION ¸Þ¼¼Áö 󸮽ÿ¡´Â return°ªÀ¸·Î true¸¦ Á༠imeÀÔ·Â ¸Þ¼¼Áö°¡ ´õÀÌ»ó ´Ù¸¥ °÷À¸·Î Àü´ÞµÇÁö ¾Ê°Ô ¸·´Â´Ù.
#pragma comment(lib, "imm32.lib")
#include <imm.h>
void processImeInput(LPARAM lParam, CEGUI::System *pCEGUISystem)
{
// È°¼ºÈµÈ CEGUIÀ©µµ¿ì°¡ EditboxŸÀÔÀÌ ¾Æ´Ï¶ó¸é IME ÀÔ·Âó¸® ¾ÈÇÕ
for(int i = 0; i < nLength; i++)Window* myRoot = CEGUI::System::getSingleton().getGUISheet(); CEGUI::Editbox *pEditWindow =(CEGUI::Editbox*)myRoot->getActiveChild(); if(pEditWindow == NULL)
return;
// IME ÇÚµé¾ò±â. ½ÇÆÐÇϸé IME ÀÔ·Âó¸® ¾ÈÇÔHIMC hImc = ImmGetContext(GetWindowReference()); if(hImc == NULL)
return;
// º¯¼ö ¼³Á¤int nLength = 0; wchar_t wszComp[4] = {0,}; // IME ¹®ÀÚ Á¶ÇÕÀÌ ¿Ï·áµÇ¾ú´Ù¸é if(lParam == GCS_RESULTSTR) {
{
}
if(wszComp[i] != 0)
}
pCEGUISystem->injectChar(wszComp[i]);
// ¹®ÀÚ Á¶ÇÕÀÌ ¿Ï·áµÇ¾úÀ¸¸é Á¶ÇÕÁßÀÎ ¹®ÀÚ ¼±ÅÃÇØÁ¦ size_t caretIndex = pEditWindow->getCaratIndex();
pEditWindow->setSelection(caretIndex, caretIndex);
}
}
nLength = ImmGetCompositionStringW(hImc, GCS_COMPSTR, NULL, 0);// IME ¹®ÀÚ Á¶ÇÕÁßÀ̶ó¸é else { if(nLength > 0) {
ImmGetCompositionStringW(hImc, GCS_COMPSTR, wszComp, nLength);
}for(int i = 0; i < nLength; i++) { } // ¿¡µðÆ® ÀÔ·ÂâÀ» À§ÇØ Á¶ÇÕÁßÀÎ ¹®ÀÚ°¡ ¼±Åõǵµ·Ï ÇÔ size_t caretIndex = pEditWindow->getCaratIndex(); pEditWindow->setSelection(caretIndex - 1, caretIndex);
¹®Á¦Á¡; ½ºÆäÀ̽º¹Ù¸¦ ´·¯Á༠Á¶ÇÕÀ» ³¡³»¸é ±×Á¦¼¾ß º¸ÀÌ´Â ¹®Á¦°¡ ÀÖÀ½
´ÙÀ½Àº WM_CHAR ¸Þ½Ã¿¡¼ ó¸®ÇÏ´Â ¹æ¹ýÀ¸·Î ÀÔ·ÂµÈ ±ÛÀÚ°¡ ³Ñ¾î¿ÔÀ» ¶§ 2¹ÙÀÌÆ® ¹®ÀÚÀÎÁö 1¹ÙÀÌÆ®¹®ÀÚÀÎÁö üũÇؼ
1¹ÙÀÌÆ® ¹®ÀÚ¶ó¸é ÀÔ·Â ¹Þ´Â Áï½Ã ³Ñ±â°í, 2¹ÙÀÌÆ® ¹®ÀÚ¶ó¸é ´©Àû½ÃÅ°°í 2¹ÙÀÌÆ® ´©ÀûÀÌ ´ÙµÇ¸é UTF-8·Î ÄÁ¹öÆ® Çؼ ³Ñ±ä´Ù.
#include < ctype.h >
inline int __cdecl isLeadByte(int _C) {return ((unsigned char)(_C) & 0x80); }
switch(pEventRecord->uiMsg)
{
case WM_CHAR:
}{
static char MultiByte[2] = {0};
}static bool isHaveMultiByte = false; if(isHaveMultiByte) {
isHaveMultiByte = false;
}MultiByte[1] = (unsigned char)pEventRecord->wParam; int iLengthUnicode = 0; wchar_t szUnicode; MultiByteToWideChar(CP_ACP, 0, (char*)MultiByte, 2, &szUnicode, 1); CEGUI::System::getSingleton().injectChar((CEGUI::utf32)szUnicode); break; else {
if( isLeadByte(pEventRecord->wParam) )
} { } else { } break; 3 °ø°³ GUI ¶óÀ̺귯¸® ¸µÅ© ¸ðÀ½ #GPG¿¡ pacman´ÔÀÌ 2004.04.13 Á¤¸®ÇØ ÁֽŠ³»¿ë ( http://www.gpgstudy.com/forum/viewtopic.php?topic=5016 )
|
ÁöÇý´Â °®°í ´Ù´Ï±â¿£ ½±Áö¸¸ ¾ò±â¿£ Èûµç °ÍÀÌ´Ù. Programe's Guides °üÀ½Àå Ã¥°¥ÇÇ_The_Pragmatic_Programmer ¸Þ¸ðÀå_DXTn |