1 /** @file scim_hangul_imengine.cpp
5 * Smart Common Input Method
7 * Copyright (C) 2004-2006 Choe Hwanjin
8 * Copyright (c) 2004-2006 James Su <suzhe@tsinghua.org.cn>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
24 * $Id: scim_hangul_imengine.cpp,v 1.34 2007/05/27 13:08:07 hwanjin Exp $
27 #define Uses_SCIM_UTILITY
28 #define Uses_SCIM_IMENGINE
29 #define Uses_SCIM_LOOKUP_TABLE
30 #define Uses_SCIM_CONFIG_BASE
37 #include "scim_hangul_imengine.h"
42 #define _(String) dgettext(GETTEXT_PACKAGE,String)
43 #define N_(String) (String)
45 #define _(String) (String)
46 #define N_(String) (String)
47 #define bindtextdomain(Package,Directory)
48 #define textdomain(domain)
49 #define bind_textdomain_codeset(domain,codeset)
52 #define scim_module_init hangul_LTX_scim_module_init
53 #define scim_module_exit hangul_LTX_scim_module_exit
54 #define scim_imengine_module_init hangul_LTX_scim_imengine_module_init
55 #define scim_imengine_module_create_factory hangul_LTX_scim_imengine_module_create_factory
57 #define SCIM_IMENGINE_HANGUL "/IMEngine/Hangul"
59 #define SCIM_CONFIG_PREFIX SCIM_IMENGINE_HANGUL
61 #define SCIM_CONFIG_SHOW_CANDIDATE_COMMENT SCIM_CONFIG_PREFIX "/ShowCandidateComment"
62 #define SCIM_CONFIG_HANGUL_KEY SCIM_CONFIG_PREFIX "/HangulKey"
63 #define SCIM_CONFIG_HANJA_KEY SCIM_CONFIG_PREFIX "/HanjaKey"
64 #define SCIM_CONFIG_HANJA_MODE_KEY SCIM_CONFIG_PREFIX "/HanjaModeKey"
65 #define SCIM_CONFIG_LAYOUT SCIM_CONFIG_PREFIX "/KeyboardLayout"
66 #define SCIM_CONFIG_USE_ASCII_MODE SCIM_CONFIG_PREFIX "/UseAsciiMode"
67 #define SCIM_CONFIG_COMMIT_BY_WORD SCIM_CONFIG_PREFIX "/CommitByWord"
68 #define SCIM_CONFIG_HANJA_MODE SCIM_CONFIG_PREFIX "/HanjaMode"
70 #define SCIM_CONFIG_PANEL_LOOKUP_TABLE_VERTICAL "/Panel/Gtk/LookupTableVertical"
72 #define SCIM_PROP_PREFIX "/IMEngine/Hangul"
73 #define SCIM_PROP_HANGUL_MODE SCIM_PROP_PREFIX "/HangulMode"
74 #define SCIM_PROP_HANJA_MODE SCIM_PROP_PREFIX "/HanjaMode"
76 #define SCIM_PROP_LAYOUT SCIM_PROP_PREFIX "/Layout"
77 #define SCIM_PROP_LAYOUT_2 SCIM_PROP_LAYOUT "/2"
78 #define SCIM_PROP_LAYOUT_32 SCIM_PROP_LAYOUT "/32"
79 #define SCIM_PROP_LAYOUT_39 SCIM_PROP_LAYOUT "/39"
80 #define SCIM_PROP_LAYOUT_3F SCIM_PROP_LAYOUT "/3f"
81 #define SCIM_PROP_LAYOUT_3S SCIM_PROP_LAYOUT "/3s"
82 #define SCIM_PROP_LAYOUT_3Y SCIM_PROP_LAYOUT "/3y"
84 #ifndef SCIM_HANGUL_ICON_FILE
85 #define SCIM_HANGUL_ICON_FILE (SCIM_ICONDIR "/scim-hangul.png")
88 static ConfigPointer _scim_config (0);
90 static Property keyboard_layout (SCIM_PROP_LAYOUT, "");
91 static Property keyboard_layout_2 (SCIM_PROP_LAYOUT_2, "");
92 static Property keyboard_layout_32(SCIM_PROP_LAYOUT_32, "");
93 static Property keyboard_layout_3f(SCIM_PROP_LAYOUT_3F, "");
94 static Property keyboard_layout_39(SCIM_PROP_LAYOUT_39, "");
95 static Property keyboard_layout_3s(SCIM_PROP_LAYOUT_3S, "");
96 static Property keyboard_layout_3y(SCIM_PROP_LAYOUT_3Y, "");
98 static Property hangul_mode(SCIM_PROP_HANGUL_MODE, "");
99 static Property hanja_mode(SCIM_PROP_HANJA_MODE, "");
102 void scim_module_init (void)
104 bindtextdomain (GETTEXT_PACKAGE, SCIM_HANGUL_LOCALEDIR);
105 bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
108 void scim_module_exit (void)
110 _scim_config.reset ();
113 uint32 scim_imengine_module_init (const ConfigPointer &config)
115 SCIM_DEBUG_IMENGINE(1) << "Initialize Hangul Engine\n";
117 _scim_config = config;
119 keyboard_layout_2.set_label(_("2bul"));
120 keyboard_layout_32.set_label(_("3bul 2bul-shifted"));
121 keyboard_layout_3f.set_label(_("3bul Final"));
122 keyboard_layout_39.set_label(_("3bul 390"));
123 keyboard_layout_3s.set_label(_("3bul No-Shift"));
124 keyboard_layout_3y.set_label(_("3bul Yetgeul"));
129 IMEngineFactoryPointer scim_imengine_module_create_factory (uint32 engine)
131 HangulFactory *factory = 0;
134 factory = new HangulFactory (_scim_config);
144 HangulFactory::HangulFactory (const ConfigPointer &config)
146 m_uuid = "d75857a5-4148-4745-89e2-1da7ddaf70a9";
147 m_name = _("Korean");
149 m_keyboard_layout = "2";
150 m_show_candidate_comment = true;
151 m_use_ascii_mode = false;
152 m_commit_by_word = false;
154 m_hanja_table = hanja_table_load(NULL);
155 m_symbol_table = NULL;
157 std::string symbol_file = getenv("HOME");
158 symbol_file += "/.scim/hangul/symbol.txt";
159 if (access(symbol_file.c_str(), R_OK) == 0)
160 m_symbol_table = hanja_table_load(symbol_file.c_str());
161 if (m_symbol_table == NULL) {
162 symbol_file = SCIM_HANGUL_DATADIR "/symbol.txt";
163 if (access(symbol_file.c_str(), R_OK) == 0)
164 m_symbol_table = hanja_table_load(symbol_file.c_str());
167 set_languages ("ko");
169 reload_config(m_config);
171 m_reload_signal_connection = m_config->signal_connect_reload(slot(this, &HangulFactory::reload_config));
174 HangulFactory::~HangulFactory ()
176 m_reload_signal_connection.disconnect();
177 if (m_hanja_table != NULL)
178 hanja_table_delete(m_hanja_table);
180 if (m_symbol_table != NULL)
181 hanja_table_delete(m_symbol_table);
185 HangulFactory::get_name () const
187 return utf8_mbstowcs (m_name);
191 HangulFactory::get_authors () const
193 return utf8_mbstowcs (String (_("Copyright (C) 2006 Choe Hwanjin <choe.hwanjin@gmail.com>")));
197 HangulFactory::get_credits () const
199 return WideString ();
203 HangulFactory::get_help () const
206 _("Key bindings:\n");
210 scim_key_list_to_string(hangul_keys, m_hangul_keys);
211 scim_key_list_to_string(hanja_keys, m_hanja_keys);
213 char paragraph1[512];
214 char paragraph2[512];
216 snprintf(paragraph1, sizeof(paragraph1),
217 _(" Hangul key: %s\n"
218 " This key binding is to switch the input mode between the ASCII input \n"
219 " mode and the hangul input mode.\n"), hangul_keys.c_str());
220 snprintf(paragraph2, sizeof(paragraph2),
222 " This key binding is to convert a hangul character to a hanja character.\n"), hanja_keys.c_str());
224 return utf8_mbstowcs (header)
225 + utf8_mbstowcs (paragraph1)
226 + utf8_mbstowcs (paragraph2);
230 HangulFactory::get_uuid () const
236 HangulFactory::get_icon_file () const
238 return String (SCIM_HANGUL_ICON_FILE);
242 HangulFactory::reload_config(const ConfigPointer &config)
247 m_show_candidate_comment = config->read(String(SCIM_CONFIG_SHOW_CANDIDATE_COMMENT),
248 m_show_candidate_comment);
250 m_keyboard_layout = config->read(String(SCIM_CONFIG_LAYOUT), String("2"));
252 m_use_ascii_mode = config->read(String(SCIM_CONFIG_USE_ASCII_MODE),
254 m_commit_by_word = config->read(String(SCIM_CONFIG_COMMIT_BY_WORD),
256 m_hanja_mode = config->read(String(SCIM_CONFIG_HANJA_MODE),
260 str = config->read(String(SCIM_CONFIG_HANGUL_KEY),
261 String("Hangul,Shift+space"));
262 scim_string_to_key_list(m_hangul_keys, str);
264 str = config->read(String (SCIM_CONFIG_HANJA_KEY),
265 String ("Hangul_Hanja,F9"));
266 scim_string_to_key_list(m_hanja_keys, str);
268 str = config->read(String (SCIM_CONFIG_HANJA_MODE_KEY),
270 scim_string_to_key_list(m_hanja_mode_keys, str);
272 m_lookup_table_vertical = config->read(String(SCIM_CONFIG_PANEL_LOOKUP_TABLE_VERTICAL),
276 IMEngineInstancePointer
277 HangulFactory::create_instance (const String &encoding, int id)
279 SCIM_DEBUG_IMENGINE(1) << "create_instance: HangulInstance.\n";
280 return new HangulInstance (this, encoding, id);
283 HangulInstance::HangulInstance (HangulFactory *factory,
284 const String &encoding,
286 : IMEngineInstanceBase (factory, encoding, id),
289 m_output_mode (OUTPUT_MODE_SYLLABLE)
291 m_hic = hangul_ic_new(factory->m_keyboard_layout.c_str());
294 std::vector <WideString> labels;
296 for (int i = 1; i < 10; ++i) {
297 snprintf (label, sizeof(label), "%d", i);
298 labels.push_back (utf8_mbstowcs (label));
301 m_lookup_table.set_candidate_labels (labels);
303 m_hangul_mode = true;
306 HangulInstance::~HangulInstance ()
311 HangulInstance::candidate_key_event (const KeyEvent &key)
314 case SCIM_KEY_Return:
315 case SCIM_KEY_KP_Enter:
316 select_candidate (m_lookup_table.get_cursor_pos_in_current_page ());
318 case SCIM_KEY_KP_Subtract:
319 m_lookup_table.cursor_up ();
320 update_lookup_table (m_lookup_table);
321 hangul_update_aux_string ();
327 case SCIM_KEY_KP_Add:
328 m_lookup_table.cursor_down ();
329 update_lookup_table (m_lookup_table);
330 hangul_update_aux_string ();
332 case SCIM_KEY_Page_Up:
333 lookup_table_page_up();
335 case SCIM_KEY_Page_Down:
336 case SCIM_KEY_KP_Tab:
337 lookup_table_page_down();
344 if (m_factory->m_lookup_table_vertical) {
345 lookup_table_page_up();
347 m_lookup_table.cursor_up ();
348 update_lookup_table (m_lookup_table);
349 hangul_update_aux_string ();
357 if (m_factory->m_lookup_table_vertical) {
358 lookup_table_page_down();
360 m_lookup_table.cursor_down ();
361 update_lookup_table (m_lookup_table);
362 hangul_update_aux_string ();
370 if (m_factory->m_lookup_table_vertical) {
371 m_lookup_table.cursor_up ();
372 update_lookup_table (m_lookup_table);
373 hangul_update_aux_string ();
375 lookup_table_page_up();
383 if (m_factory->m_lookup_table_vertical) {
384 m_lookup_table.cursor_down ();
385 update_lookup_table (m_lookup_table);
386 hangul_update_aux_string ();
388 lookup_table_page_down();
391 case SCIM_KEY_Escape:
392 delete_candidates ();
405 select_candidate (key.code - SCIM_KEY_1);
408 return !is_hanja_mode();
415 HangulInstance::process_key_event (const KeyEvent& rawkey)
417 SCIM_DEBUG_IMENGINE(1) << "process_key_event.\n";
419 KeyEvent key = rawkey.map_to_layout(SCIM_KEYBOARD_Default);
423 if (use_ascii_mode() && !is_hangul_mode()) {
424 if (is_hangul_key(key)) {
425 toggle_hangul_mode();
432 /* ignore key release. */
433 if (key.is_key_release ())
437 if (use_ascii_mode() && is_hangul_key(key)) {
438 toggle_hangul_mode();
443 if (is_hanja_mode_key (key)) {
447 /* toggle candidate table */
448 if (is_hanja_key (key)) {
449 if (is_hanja_mode()) {
450 update_candidates ();
452 if (m_lookup_table.number_of_candidates ())
453 delete_candidates ();
455 update_candidates ();
461 /* ignore shift keys */
462 if (key.code == SCIM_KEY_Shift_L || key.code == SCIM_KEY_Shift_R)
465 /* flush on modifier-on keys */
466 if (key.is_control_down() || key.is_alt_down()) {
472 if (m_lookup_table.number_of_candidates ()) {
473 if (candidate_key_event(key))
477 /* change to ascii mode on ESCAPE key, for vi users.
478 * We should process this key after processing candidate keys,
479 * or input mode will be changed to non-hangul mode when the user presses
480 * escape key to close candidate window. */
481 if (use_ascii_mode() && !is_hanja_mode()) {
482 if (key.code == SCIM_KEY_Escape) {
483 toggle_hangul_mode();
488 if (is_backspace_key(key)) {
489 bool ret = hangul_ic_backspace(m_hic);
491 hangul_update_preedit_string ();
492 } else if (m_preedit.length() > 0) {
494 m_preedit.erase(m_preedit.length() - 1, 1);
495 hangul_update_preedit_string();
497 if (m_surrounding_text.length() > 0) {
498 m_surrounding_text.erase(m_surrounding_text.length() - 1, 1);
499 if (m_surrounding_text.empty()) {
506 if (is_hanja_mode() && m_lookup_table.number_of_candidates()) {
513 if (key.code >= SCIM_KEY_exclam && key.code <= SCIM_KEY_asciitilde) {
514 /* main hangul composing process */
515 int ascii = key.get_ascii_code();
516 if (key.is_caps_lock_down()) {
518 ascii = tolower(ascii);
519 else if (islower(ascii))
520 ascii = toupper(ascii);
523 bool ret = hangul_ic_process(m_hic, ascii);
526 wstr = get_commit_string ();
527 if (wstr.length ()) {
528 /* Before commit, we set preedit string to null to work arround
529 * some buggy IM implementation, ex) Qt, Evolution */
530 hide_preedit_string ();
531 if (is_hanja_mode() || m_factory->m_commit_by_word) {
538 if (is_hanja_mode() || m_factory->m_commit_by_word) {
539 if (hangul_ic_is_empty(m_hic)) {
544 hangul_update_preedit_string ();
546 if (is_hanja_mode()) {
558 HangulInstance::move_preedit_caret (unsigned int pos)
563 HangulInstance::select_candidate (unsigned int index)
565 SCIM_DEBUG_IMENGINE(2) << "select_candidate.\n";
567 if ((int)index >= m_lookup_table.get_current_page_size ())
570 WideString candidate = m_lookup_table.get_candidate_in_current_page(index);
572 WideString commit_str = candidate;
573 WideString preedit = get_preedit_string();
574 if (is_hanja_mode() || m_factory->m_commit_by_word) {
576 int len = m_surrounding_text.length();
578 delete_surrounding_text(-len, len);
579 if (candidate.length() <= m_surrounding_text.length()) {
580 len = m_surrounding_text.length() - candidate.length();
581 commit_str.append(m_surrounding_text, candidate.length(), len);
582 m_surrounding_text.erase(0, candidate.length());
583 } else if (candidate.length() <= m_surrounding_text.length() + preedit.length()) {
584 len = candidate.length() - m_surrounding_text.length();
585 if (len > m_preedit.length()) {
587 hangul_ic_reset(m_hic);
589 m_preedit.erase(0, len);
591 m_surrounding_text.clear();
594 hangul_ic_reset(m_hic);
595 m_surrounding_text.clear();
599 if (candidate.length() > preedit.length()) {
600 int len = candidate.length() - preedit.length();
601 delete_surrounding_text(-len, len);
603 hangul_ic_reset(m_hic);
604 m_surrounding_text.clear();
607 commit_string(commit_str);
608 hangul_update_preedit_string ();
610 if (is_hanja_mode()) {
618 HangulInstance::update_lookup_table_page_size (unsigned int page_size)
620 SCIM_DEBUG_IMENGINE(2) << "update_lookup_table_page_size.\n";
622 m_lookup_table.set_page_size (page_size);
626 HangulInstance::lookup_table_page_up ()
628 if (!m_lookup_table.number_of_candidates () || !m_lookup_table.get_current_page_start ())
631 SCIM_DEBUG_IMENGINE(2) << "lookup_table_page_up.\n";
633 m_lookup_table.page_up ();
635 update_lookup_table (m_lookup_table);
637 hangul_update_aux_string ();
641 HangulInstance::lookup_table_page_down ()
643 if (m_lookup_table.number_of_candidates () <= 0 ||
644 m_lookup_table.get_current_page_start () + m_lookup_table.get_current_page_size () >=
645 (int)m_lookup_table.number_of_candidates ())
648 SCIM_DEBUG_IMENGINE(2) << "lookup_table_page_down.\n";
650 m_lookup_table.page_down ();
652 update_lookup_table (m_lookup_table);
654 hangul_update_aux_string ();
658 HangulInstance::reset()
660 SCIM_DEBUG_IMENGINE(2) << "reset.\n";
665 HangulInstance::flush()
667 SCIM_DEBUG_IMENGINE(2) << "flush.\n";
669 hide_preedit_string();
671 WideString wstr = m_preedit;
672 const ucschar *str = hangul_ic_flush(m_hic);
674 wstr.push_back (*str++);
679 delete_candidates ();
684 HangulInstance::focus_in ()
686 SCIM_DEBUG_IMENGINE(2) << "focus_in.\n";
688 register_all_properties();
690 if (m_lookup_table.number_of_candidates ()) {
691 update_lookup_table (m_lookup_table);
692 show_lookup_table ();
694 hide_lookup_table ();
697 hangul_update_aux_string ();
701 HangulInstance::focus_out ()
703 SCIM_DEBUG_IMENGINE(2) << "focus_out.\n";
708 HangulInstance::trigger_property (const String &property)
710 SCIM_DEBUG_IMENGINE(2) << "trigger_property.\n";
711 if (property == SCIM_PROP_HANGUL_MODE) {
712 toggle_hangul_mode();
713 } else if (property == SCIM_PROP_HANJA_MODE) {
715 } else if (property.compare(0, strlen(SCIM_PROP_LAYOUT), SCIM_PROP_LAYOUT) == 0) {
716 int pos = strlen(SCIM_PROP_LAYOUT) + 1;
717 int len = property.length() - pos;
718 change_keyboard_layout(property.substr(pos, len));
723 HangulInstance::get_candidate_string()
726 if (m_surrounding_text.empty())
727 get_surrounding_text(m_surrounding_text, cursor, 10, 0);
730 for (i = m_surrounding_text.length() - 1; i >= 0; i--) {
731 if (!hangul_is_syllable(m_surrounding_text[i]))
735 m_surrounding_text.erase(0, i + 1);
737 return utf8_wcstombs(m_surrounding_text + get_preedit_string());
741 HangulInstance::update_candidates ()
743 m_lookup_table.clear ();
744 m_candidate_comments.clear ();
746 HanjaList* list = NULL;
748 // search for symbol character
749 // key string for symbol character is like:
750 // 'ㄱ', 'ㄴ', 'ㄷ', etc
751 WideString preeditw = get_preedit_string();
752 if (preeditw.length() == 1) {
753 String key = utf8_wcstombs(preeditw);
754 list = hanja_table_match_suffix(m_factory->m_symbol_table, key.c_str());
759 String str = get_candidate_string();
760 SCIM_DEBUG_IMENGINE(1) << "candidate string: " << str << "\n";
762 if (str.length() > 0) {
763 if (is_hanja_mode() || m_factory->m_commit_by_word) {
764 list = hanja_table_match_prefix(m_factory->m_hanja_table,
767 list = hanja_table_match_suffix(m_factory->m_hanja_table,
774 int n = hanja_list_get_size(list);
775 for (int i = 0; i < n; ++i) {
776 const char* value = hanja_list_get_nth_value(list, i);
777 const char* comment = hanja_list_get_nth_comment(list, i);
778 WideString candidate = utf8_mbstowcs(value, -1);
779 m_lookup_table.append_candidate(candidate);
780 m_candidate_comments.push_back(String(comment));
783 m_lookup_table.set_page_size (9);
784 m_lookup_table.show_cursor ();
786 update_lookup_table (m_lookup_table);
787 show_lookup_table ();
789 hangul_update_aux_string ();
791 hanja_list_delete(list);
794 if (m_lookup_table.number_of_candidates() <= 0) {
800 HangulInstance::delete_candidates ()
802 m_surrounding_text.clear();
803 m_lookup_table.clear ();
804 m_candidate_comments.clear ();
805 hide_lookup_table ();
810 HangulInstance::hangul_update_aux_string ()
812 if (!m_factory->m_show_candidate_comment || !m_lookup_table.number_of_candidates ()) {
817 size_t cursor = m_lookup_table.get_cursor_pos ();
819 if (cursor >= m_candidate_comments.size ()) {
824 update_aux_string (m_lookup_table.get_candidate (cursor) + utf8_mbstowcs (String (" : ") + m_candidate_comments [cursor]));
829 HangulInstance::hangul_update_preedit_string ()
831 WideString wstr = get_preedit_string ();
833 if (wstr.length ()) {
835 attrs.push_back(Attribute(0, m_preedit.length(), SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_UNDERLINE));
836 attrs.push_back(Attribute(m_preedit.length(), wstr.length() - m_preedit.length(), SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_UNDERLINE));
837 show_preedit_string ();
838 update_preedit_string (wstr, attrs);
839 update_preedit_caret (wstr.length());
841 hide_preedit_string ();
846 HangulInstance::match_key_event (const KeyEventList &keys, const KeyEvent &key) const
848 KeyEventList::const_iterator kit;
850 for (kit = keys.begin (); kit != keys.end (); ++kit) {
851 if (!key.is_key_release()) {
852 if (key.code == kit->code) {
854 // we should ignore capslock and numlock
855 mask &= ~SCIM_KEY_CapsLockMask;
856 mask &= ~SCIM_KEY_NumLockMask;
857 if (mask == kit->mask)
866 HangulInstance::toggle_hangul_mode()
868 m_hangul_mode = !m_hangul_mode;
872 hangul_mode.set_label("한");
874 hangul_mode.set_label("A");
877 update_property(hangul_mode);
881 HangulInstance::toggle_hanja_mode()
883 m_factory->m_hanja_mode = !m_factory->m_hanja_mode;
885 if (m_factory->m_hanja_mode) {
886 hanja_mode.set_label("漢");
888 hanja_mode.set_label("韓");
891 update_property(hanja_mode);
893 m_factory->m_config->write(String(SCIM_CONFIG_HANJA_MODE), m_factory->m_hanja_mode);
897 HangulInstance::change_keyboard_layout(const String &layout)
901 label = keyboard_layout_2.get_label();
902 } else if (layout == "32") {
903 label = keyboard_layout_32.get_label();
904 } else if (layout == "3f") {
905 label = keyboard_layout_3f.get_label();
906 } else if (layout == "39") {
907 label = keyboard_layout_39.get_label();
908 } else if (layout == "3s") {
909 label = keyboard_layout_3s.get_label();
910 } else if (layout == "3y") {
911 label = keyboard_layout_3y.get_label();
914 m_factory->m_keyboard_layout = layout;
915 keyboard_layout.set_label(label);
916 hangul_ic_select_keyboard(m_hic, m_factory->m_keyboard_layout.c_str());
918 update_property(keyboard_layout);
920 m_factory->m_config->write(String(SCIM_CONFIG_LAYOUT), layout);
924 HangulInstance::register_all_properties()
926 PropertyList proplist;
928 const char* layout_label = NULL;
929 if (m_factory->m_keyboard_layout == "2") {
930 layout_label = _("2bul");
931 } else if (m_factory->m_keyboard_layout == "32") {
932 layout_label = _("3bul 2bul-shifted");
933 } else if (m_factory->m_keyboard_layout == "3f") {
934 layout_label = _("3bul Final");
935 } else if (m_factory->m_keyboard_layout == "39") {
936 layout_label = _("3bul 390");
937 } else if (m_factory->m_keyboard_layout == "3s") {
938 layout_label = _("3bul No-Shift");
939 } else if (m_factory->m_keyboard_layout == "3y") {
940 layout_label = _("3bul Yetgeul");
943 keyboard_layout.set_label(layout_label);
944 proplist.push_back(keyboard_layout);
945 proplist.push_back(keyboard_layout_2);
946 proplist.push_back(keyboard_layout_32);
947 proplist.push_back(keyboard_layout_3f);
948 proplist.push_back(keyboard_layout_39);
949 proplist.push_back(keyboard_layout_3s);
950 proplist.push_back(keyboard_layout_3y);
952 if (use_ascii_mode()) {
954 hangul_mode.set_label("한");
956 hangul_mode.set_label("A");
958 proplist.push_back(hangul_mode);
961 if (is_hanja_mode()) {
962 hanja_mode.set_label("漢");
964 hanja_mode.set_label("韓");
966 proplist.push_back(hanja_mode);
968 register_properties(proplist);
971 //vim: ts=4:nowrap:ai:expandtab: