From ecd9b93de5110cfb194ae82fd6a9757045170b5c Mon Sep 17 00:00:00 2001 From: Choe Hwanjin Date: Sun, 20 Apr 2008 15:48:59 +0900 Subject: [PATCH] =?utf8?q?hangul=20input=20context=20=EA=B0=9C=EC=84=A0:?= =?utf8?q?=20=20*=20hangul=5Fic=5Fselect=5Fkeyboard()=20=ED=95=A8=EC=88=98?= =?utf8?q?=EC=97=90=EC=84=9C=20output=20mode=20=EC=B4=88=EA=B8=B0=ED=99=94?= =?utf8?q?=20=ED=95=A8=20=20*=20HangulInputContext::use=5Fjamo=5Fmode=5Fon?= =?utf8?q?ly=20=EA=B0=92=EC=97=90=20=EB=94=B0=EB=9D=BC=EC=84=9C=20=20=20?= =?utf8?q?=20output=20mode=20=EC=84=A4=EC=A0=95=20=EA=B8=B0=EB=8A=A5?= =?utf8?q?=EC=9D=B4=20=EB=8F=99=EC=9E=91=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?utf8?q?=ED=95=A8=20=20*=20=EC=84=B8=EB=B2=8C=EC=8B=9D=20=EC=98=9B?= =?utf8?q?=EA=B8=80=20=EC=9E=90=ED=8C=90=EC=9D=84=20=EC=84=A0=ED=83=9D?= =?utf8?q?=ED=96=88=EB=8B=A4=EA=B0=80=20=ED=98=84=EB=8C=80=EA=B8=80?= =?utf8?q?=EC=9E=90=ED=8C=90=EC=9C=BC=EB=A1=9C=20=EB=B0=94=EA=BE=B8?= =?utf8?q?=EB=A9=B4=20jamo=20output=20=EB=AA=A8=EB=93=9C=20=EC=84=A4?= =?utf8?q?=EC=A0=95=EC=9D=B4=20=20=20=20=EB=82=A8=EC=95=84=EC=9E=88?= =?utf8?q?=EB=8D=98=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95=20=20*=20lib?= =?utf8?q?hangul=20=EB=B2=84=EA=B7=B8:=20#304765?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@173 8f00fcd2-89fc-0310-932e-b01be5b65e01 --- hangul/hangulinputcontext.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/hangul/hangulinputcontext.c b/hangul/hangulinputcontext.c index cab91de..2ed190e 100644 --- a/hangul/hangulinputcontext.c +++ b/hangul/hangulinputcontext.c @@ -29,6 +29,14 @@ #include "hangul.h" #include "hangulinternals.h" +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + #define HANGUL_KEYBOARD_TABLE_SIZE 0x80 typedef void (*HangulOnTranslate) (HangulInputContext*, @@ -87,6 +95,8 @@ struct _HangulInputContext { HangulICFilter filter; void *filter_data; + + unsigned int use_jamo_mode_only : 1; }; #include "hangulkeyboard.h" @@ -1039,7 +1049,8 @@ hangul_ic_set_output_mode(HangulInputContext *hic, int mode) if (hic == NULL) return; - hic->output_mode = mode; + if (!hic->use_jamo_mode_only) + hic->output_mode = mode; } void @@ -1106,22 +1117,33 @@ hangul_ic_select_keyboard(HangulInputContext *hic, const char* id) if (strcmp(id, "32") == 0) { hic->keyboard = &hangul_keyboard_32; hic->combination = &hangul_combination_default; + hic->output_mode = HANGUL_OUTPUT_SYLLABLE; + hic->use_jamo_mode_only = FALSE; } else if (strcmp(id, "39") == 0) { hic->keyboard = &hangul_keyboard_390; hic->combination = &hangul_combination_default; + hic->output_mode = HANGUL_OUTPUT_SYLLABLE; + hic->use_jamo_mode_only = FALSE; } else if (strcmp(id, "3f") == 0) { hic->keyboard = &hangul_keyboard_3final; hic->combination = &hangul_combination_default; + hic->output_mode = HANGUL_OUTPUT_SYLLABLE; + hic->use_jamo_mode_only = FALSE; } else if (strcmp(id, "3s") == 0) { hic->keyboard = &hangul_keyboard_3sun; hic->combination = &hangul_combination_default; + hic->output_mode = HANGUL_OUTPUT_SYLLABLE; + hic->use_jamo_mode_only = FALSE; } else if (strcmp(id, "3y") == 0) { hic->keyboard = &hangul_keyboard_3yet; hic->combination = &hangul_combination_full; hic->output_mode = HANGUL_OUTPUT_JAMO; + hic->use_jamo_mode_only = TRUE; } else { hic->keyboard = &hangul_keyboard_2; hic->combination = &hangul_combination_default; + hic->output_mode = HANGUL_OUTPUT_SYLLABLE; + hic->use_jamo_mode_only = FALSE; } } @@ -1144,11 +1166,6 @@ hangul_ic_new(const char* keyboard) if (hic == NULL) return NULL; - hangul_ic_set_output_mode(hic, HANGUL_OUTPUT_SYLLABLE); - hangul_ic_select_keyboard(hic, keyboard); - - hangul_buffer_clear(&hic->buffer); - hic->preedit_string[0] = 0; hic->commit_string[0] = 0; hic->flushed_string[0] = 0; @@ -1159,6 +1176,13 @@ hangul_ic_new(const char* keyboard) hic->on_transition = NULL; hic->on_transition_data = NULL; + hic->use_jamo_mode_only = FALSE; + + hangul_ic_set_output_mode(hic, HANGUL_OUTPUT_SYLLABLE); + hangul_ic_select_keyboard(hic, keyboard); + + hangul_buffer_clear(&hic->buffer); + return hic; } -- 2.7.4