source: dev/ProjectEditor/TextEditor_ImeEvent.cpp@ 24

Last change on this file since 24 was 24, checked in by dai_9181, 17 years ago

保存されていないドキュメントのタブに(*)をつける機能に対応。
MDITEXTEDITINFOをCMdiTextEditに変更。今後、オブジェクト指向化を進める。

File size: 1.9 KB
Line 
1#include "common.h"
2
3extern HFONT hFont_TextEdit,hFont_HyperLink_TextEdit;
4extern int font_width,font_height;
5
6void TextEditEvent_IME_StartComposition(HWND hwnd){
7 int WndNum;
8 WndNum=GetWndNum(GetParent(hwnd));
9
10 int iControlTabSpace;
11 iControlTabSpace=MdiInfo[WndNum].pMdiTextEdit->iWidth_ControlTabSpace;
12
13 HIMC hIMC;
14 hIMC=ImmGetContext(hwnd);
15
16 //コンポジションをセット
17 POINT pos;
18 COMPOSITIONFORM CompForm;
19 CompForm.dwStyle=CFS_POINT;
20 pos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
21 GetScrollBaseCaretPos(WndNum,(int *)&pos.x,(int *)&pos.y);
22 CompForm.ptCurrentPos.x=pos.x*font_width+iControlTabSpace;
23 CompForm.ptCurrentPos.y=pos.y*font_height;
24 ImmSetCompositionWindow(hIMC, &CompForm);
25
26 //フォントをセット
27 ImmSetCompositionFont(hIMC,&pobj_nv->lf);
28
29 ImmReleaseContext(hwnd,hIMC);
30}
31
32BOOL TextEditEvent_IME_Composition(HWND hwnd,LPARAM lParam){
33 if(lParam&GCS_RESULTSTR){
34 int WndNum;
35 WndNum=GetWndNum(GetParent(hwnd));
36
37 int iControlTabSpace;
38 iControlTabSpace=MdiInfo[WndNum].pMdiTextEdit->iWidth_ControlTabSpace;
39
40 ////////////////////
41 // 確定文字列を取得
42 ////////////////////
43
44 //コンテキストを取得
45 HIMC hIMC;
46 hIMC=ImmGetContext(hwnd);
47
48 int i;
49 char temporary[4096];
50 i=ImmGetCompositionString(hIMC, GCS_RESULTSTR, temporary,4096);
51 if(i==0) return 0;
52 temporary[i]=0;
53
54 //バッファをリプレイス
55 TextEdit_ReplaceUpdateUndoData(WndNum,temporary,0,1);
56 UpdateWindow(hwnd);
57
58 //コンポジションをセット(立て続けにIME入力が行われる場合を考慮)
59 POINT pos;
60 COMPOSITIONFORM CompForm;
61 CompForm.dwStyle=CFS_POINT;
62 pos=MdiInfo[WndNum].pMdiTextEdit->StartCaretPos;
63 GetScrollBaseCaretPos(WndNum,(int *)&pos.x,(int *)&pos.y);
64 CompForm.ptCurrentPos.x=pos.x*font_width+iControlTabSpace;
65 CompForm.ptCurrentPos.y=pos.y*font_height;
66 ImmSetCompositionWindow(hIMC, &CompForm);
67
68 //コンテキストを解放
69 ImmReleaseContext(hwnd,hIMC);
70 }
71
72 return 1;
73}
Note: See TracBrowser for help on using the repository browser.