Пример #1
0
gboolean full_char_proc(KeySym keysym)
{
  char *s = half_char_to_full_char(keysym);

  if (!s)
    return 0;

  char tt[CH_SZ+1];

  utf8cpy(tt, s);

  if (current_CS->im_state  == HIME_STATE_ENG_FULL) {
    send_text(tt);
    return 1;
  }

  if (current_method_type() == 6 && current_CS->im_state == HIME_STATE_CHINESE)
    add_to_tsin_buf_str(tt);
  else
  if (gtab_phrase_on() && ggg.gbufN)
    insert_gbuf_nokey(tt);
  else
    send_text(tt);

  return 1;
}
Пример #2
0
void show_hide_label_edit()
{
  if (!label_edit)
    return;

  if (hime_edit_display_ap_only() || !gtab_phrase_on()) {
    gtk_widget_hide(label_edit);
  } else
    gtk_widget_show(label_edit);
}
Пример #3
0
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();
  }
}
Пример #4
0
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;
}
Пример #5
0
static gboolean need_label_edit()
{
  return gtab_phrase_on() && !hime_edit_display_ap_only();
}