void flush_edit_buffer() { // dbg("flush_edit_buffer\n"); if (!current_CS) return; // dbg("hime_reset\n"); switch(current_method_type()) { #if USE_TSIN case method_type_TSIN: flush_tsin_buffer(); break; #endif case method_type_MODULE: if (inmd[current_CS->in_method].mod_cb_funcs) module_cb()->module_flush_input(); break; default: output_gbuf(); // dbg("metho %d\n", current_CS->in_method); } #if 0 dbg("output_bufferN:%d\n", output_bufferN); if (output_bufferN) { output_buffer_call_back(); } #endif }
void flush_edit_buffer() { // dbg("flush_edit_buffer\n"); if (!current_CS) return; // dbg("gcin_reset\n"); switch(current_method_type()) { #if USE_TSIN case method_type_TSIN: flush_tsin_buffer(); break; #endif #if USE_ANTHY case method_type_ANTHY: flush_anthy_input(); break; #endif default: output_gbuf(); // dbg("metho %d\n", current_CS->in_method); } #if 0 dbg("output_bufferN:%d\n", output_bufferN); if (output_bufferN) { output_buffer_call_back(); } #endif }
void toggle_im_enabled() { // dbg("toggle_im_enabled\n"); check_CS(); if (current_CS->in_method < 0 || current_CS->in_method > MAX_GTAB_NUM_KEY) p_err("err found"); if (current_CS->im_state != GCIN_STATE_DISABLED) { if (current_CS->im_state == GCIN_STATE_ENG_FULL) { current_CS->im_state = GCIN_STATE_CHINESE; disp_im_half_full(); return; } if (current_method_type() == method_type_TSIN) { #if USE_TSIN flush_tsin_buffer(); #endif } else { output_gbuf(); reset_gtab_all(); } hide_in_win(current_CS); #if 0 hide_win_status(); #endif current_CS->im_state = GCIN_STATE_DISABLED; update_win_kbm(); #if TRAY_ENABLED disp_tray_icon(); #endif } else { if (!current_method_type()) init_gtab(current_CS->in_method); init_state_chinese(current_CS); reset_current_in_win_xy(); #if 1 show_in_win(current_CS); update_in_win_pos(); #else update_in_win_pos(); show_in_win(current_CS); #endif update_win_kbm(); #if TRAY_ENABLED disp_tray_icon(); #endif } }
static void cb_button_sym(GtkButton *button, GtkWidget *label) { // dbg("cb_button_sym\n"); char *str = (char *) gtk_label_get_text(GTK_LABEL(label)); #if USE_TSIN if (current_method_type() == method_type_TSIN && current_CS->im_state == GCIN_STATE_CHINESE) { add_to_tsin_buf_str(str); if (tsin_cursor_end()) { flush_tsin_buffer(); output_buffer_call_back(); } else { force_preedit_shift(); } } else #endif if (gtab_phrase_on()) { insert_gbuf_nokey(str); if (gtab_cursor_end()) { output_gbuf(); output_buffer_call_back(); } else force_preedit_shift(); } else { send_text_call_back(str); } switch (current_method_type()) { case method_type_PHO: clr_in_area_pho(); break; #if USE_TSIN case method_type_TSIN: tsin_reset_in_pho(); break; #endif #if USE_ANTHY case method_type_ANTHY: break; #endif default: reset_gtab_all(); break; } if (gcin_win_sym_click_close) { win_sym_enabled=0; hide_win_sym(); } }
gboolean feed_phrase(KeySym ksym, int state) { int i; // dbg("ksym:%x %c\n", ksym, ksym); load_phrase("phrase.table", &file_modify_time, tran, tranN); load_phrase("phrase-ctrl.table", &ctrl_file_modify_time, tran_ctrl, tran_ctrlN); if (ksym < 0x7f && isupper(ksym)) ksym = tolower(ksym); struct keystruc *tr; int trN; if (state & ControlMask) { tr = tran_ctrl; trN = tran_ctrlN; } else { tr = tran; trN = tranN; } char tt[2], *str; for(i=0; i < trN; i++) { if (tr[i].ksym!= ksym) continue; str = ((state & LockMask) && tr[i].str_caps) ? tr[i].str_caps : tr[i].str; if (str) { send_it: #if USE_TSIN if (current_method_type() == method_type_TSIN && current_CS->im_state == GCIN_STATE_CHINESE) { add_to_tsin_buf_str(str); if (tsin_cursor_end()) flush_tsin_buffer(); } else #endif if (gtab_phrase_on()) { insert_gbuf_nokey(str); if (gtab_cursor_end()) output_gbuf(); } else send_text(str); return TRUE; } } #if 0 if ((state&(ControlMask|ShiftMask|Mod1Mask|Mod4Mask|Mod5Mask))==ShiftMask && ksym>=' ' && ksym < 0x7e) { str = tt; tt[0]=ksym; tt[1]=0; goto send_it; } #endif return FALSE; }
gboolean init_in_method(int in_no) { gboolean init_im = !(cur_inmd && (cur_inmd->flag & FLAG_GTAB_SYM_KBM)); if (in_no < 0) return FALSE; check_CS(); if (current_CS->in_method != in_no) { if (!(inmd[in_no].flag & FLAG_GTAB_SYM_KBM)) { if (current_method_type() == method_type_TSIN) { flush_tsin_buffer(); } else output_gbuf(); hide_in_win(current_CS); } if (cur_inmd && (cur_inmd->flag & FLAG_GTAB_SYM_KBM)) hide_win_kbm(); } reset_current_in_win_xy(); // dbg("switch init_in_method %x %d\n", current_CS, in_no); set_tsin_pho_mode0(current_CS); tsin_set_win1_cb(); switch (inmd[in_no].method_type) { case method_type_PHO: current_CS->in_method = in_no; init_tab_pho(); break; case method_type_TSIN: set_wselkey(pho_selkey); current_CS->in_method = in_no; init_tab_pp(init_im); break; case method_type_MODULE: { HIME_module_main_functions gmf; init_HIME_module_main_functions(&gmf); if (!inmd[in_no].mod_cb_funcs) { char ttt[256]; strcpy(ttt, inmd[in_no].filename); dbg("module %s\n", ttt); if (!(inmd[in_no].mod_cb_funcs = init_HIME_module_callback_functions(ttt))) { dbg("module not found\n"); return FALSE; } } if (inmd[in_no].mod_cb_funcs->module_init_win(&gmf)) { current_CS->in_method = in_no; module_cb()->module_show_win(); set_wselkey(pho_selkey); } else { return FALSE; } break; } default: init_gtab(in_no); if (!inmd[in_no].DefChars) return FALSE; current_CS->in_method = in_no; if (!(inmd[in_no].flag & FLAG_GTAB_SYM_KBM)) show_win_gtab(); else { win_kbm_inited = 1; show_win_kbm(); } set_gtab_input_method_name(inmd[in_no].cname); break; } #if WIN32 if (current_CS && current_CS->in_method != last_input_method) last_input_method = current_CS->in_method; #endif #if TRAY_ENABLED disp_tray_icon(); #endif if (inmd[current_CS->in_method].selkey) { set_wselkey(inmd[current_CS->in_method].selkey); gtab_set_win1_cb(); // dbg("aa selkey %s\n", inmd[current_CS->in_method].selkey); } update_in_win_pos(); update_win_kbm_inited(); return TRUE; }
void toggle_im_enabled() { // dbg("toggle_im_enabled\n"); check_CS(); if (current_CS->in_method < 0) p_err("err found"); if (current_CS->im_state != HIME_STATE_DISABLED) { if (current_CS->im_state == HIME_STATE_ENG_FULL) { current_CS->im_state = HIME_STATE_CHINESE; disp_im_half_full(); save_CS_current_to_temp(); return; } if (current_method_type() == method_type_TSIN) { #if USE_TSIN flush_tsin_buffer(); #endif } else if (current_method_type () == method_type_MODULE) { module_cb ()->module_flush_input (); } else { output_gbuf(); reset_gtab_all(); } hide_in_win(current_CS); #if 0 hide_win_status(); #endif current_CS->im_state = HIME_STATE_DISABLED; update_win_kbm(); #if TRAY_ENABLED disp_tray_icon(); #endif } else { if (!current_method_type()) init_gtab(current_CS->in_method); init_state_chinese(current_CS); reset_current_in_win_xy(); #if 1 show_in_win(current_CS); update_in_win_pos(); #else update_in_win_pos(); show_in_win(current_CS); #endif update_win_kbm(); #if TRAY_ENABLED disp_tray_icon(); #endif } save_CS_current_to_temp(); }
gboolean init_in_method(int in_no) { gboolean init_im = !(cur_inmd && (cur_inmd->flag & FLAG_GTAB_SYM_KBM)); if (in_no < 0 || in_no > MAX_GTAB_NUM_KEY) return FALSE; check_CS(); if (current_CS->in_method != in_no) { if (!(inmd[in_no].flag & FLAG_GTAB_SYM_KBM)) { if (current_method_type() == method_type_TSIN) { #if USE_TSIN flush_tsin_buffer(); #endif } else output_gbuf(); hide_in_win(current_CS); } if (cur_inmd && (cur_inmd->flag & FLAG_GTAB_SYM_KBM)) hide_win_kbm(); } reset_current_in_win_xy(); // dbg("switch init_in_method %x %d\n", current_CS, in_no); switch (inmd[in_no].method_type) { case method_type_PHO: current_CS->in_method = in_no; init_tab_pho(); break; #if USE_TSIN case method_type_TSIN: current_CS->in_method = in_no; set_tsin_pho_mode0(current_CS); init_tab_pp(init_im); break; #endif case method_type_INT_CODE: current_CS->in_method = in_no; init_inter_code(); break; #if USE_ANTHY case method_type_ANTHY: if (init_win_anthy()) { current_CS->in_method = in_no; show_win_anthy(); } else { return FALSE; } break; #endif default: init_gtab(in_no); if (!inmd[in_no].DefChars) return FALSE; current_CS->in_method = in_no; if (!(inmd[in_no].flag & FLAG_GTAB_SYM_KBM)) show_win_gtab(); else { win_kbm_inited = 1; show_win_kbm(); } set_gtab_input_method_name(inmd[in_no].cname); break; } #if WIN32 if (current_CS && current_CS->in_method != last_input_method) last_input_method = current_CS->in_method; #endif #if TRAY_ENABLED disp_tray_icon(); #endif update_in_win_pos(); update_win_kbm_inited(); return TRUE; }