Beispiel #1
0
void hide_win0()
{
#if WIN32
  if (test_mode)
    return;
#endif
  if (!gwin0)
    return;

#if WIN32
  if (timeout_handle) {
	  g_source_remove(timeout_handle);
	  timeout_handle = 0;
  }
#endif

  gtk_widget_hide(gwin0);
  if (destroy_window)
    destroy_win0();
  else
    destroy_top_bin();

  hide_selections_win();
  hide_win_sym();
}
Beispiel #2
0
void hide_win_pho()
{
// dbg("hide_win_pho\n");
  if (!gwin_pho)
    return;

  gtk_widget_hide(gwin_pho);
  hide_win_sym();
}
Beispiel #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();
  }
}
Beispiel #4
0
void hide_win0()
{
    if (!gwin0)
        return;

    gtk_widget_hide(gwin0);
    if (destroy_window)
        destroy_win0();
    else
        destroy_top_bin();

    hide_selections_win();
    hide_win_sym();
}
Beispiel #5
0
void hide_win_pho()
{
// dbg("hide_win_pho\n");
  if (!gwin_pho)
    return;

#if WIN32
  if (timeout_handle_pho) {
	  g_source_remove(timeout_handle_pho);
	  timeout_handle_pho = 0;
  }
#endif

  gtk_widget_hide(gwin_pho);
  hide_win_sym();
}
Beispiel #6
0
void hide_win_gtab()
{
  win_gtab_max_key_press = 0;

  if (!gwin_gtab)
    return;

//  dbg("hide_win_gtab\n");
  if (gwin_gtab) {
    if (destroy_window)
      destroy_win_gtab();
    else {
      gtk_widget_hide(gwin_gtab);
      destroy_top_bin();
    }
  }

  close_gtab_pho_win();
  hide_win_sym();
  hide_win_kbm();
}
Beispiel #7
0
void create_win_sym()
{
  if (!current_CS) {
    dbg("create_win_sym, null CS\n");
    return;
  }

  if (current_CS->in_method < 0 || current_CS->in_method >= MAX_GTAB_NUM_KEY) {
    p_err("bad current_CS %d\n", current_CS->in_method);
  }

  if (current_method_type() != method_type_PHO && current_method_type() != method_type_TSIN && current_method_type() != method_type_ANTHY && !cur_inmd)
    return;

  if (read_syms() || cur_in_method != current_CS->in_method) {
    destory_win();
  } else {
    if (!syms)
      return;
  }


  if (gwin_sym) {
    if (win_sym_enabled)
      show_win_sym();
    else
      hide_win_sym();

    return;
  }

  gwin_sym = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_has_resize_grip(GTK_WINDOW(gwin_sym), FALSE);
#if WIN32
  set_no_focus(gwin_sym);
#endif

  cur_in_method = current_CS->in_method;

  GtkWidget *hbox_top = gtk_hbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (gwin_sym), hbox_top);

  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox_top), vbox_top, TRUE, TRUE, 0);

  gtk_container_set_border_width (GTK_CONTAINER (vbox_top), 0);

  int i;
  for(i=0; i < symsN; i++) {
    SYM_ROW *psym = &syms[i];
    GtkWidget *hbox_row = gtk_hbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox_top), hbox_row, FALSE, FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (hbox_row), 0);

    int j;
    for(j=0; j < psym->symN; j++) {
      char *str = psym->sym[j];

      if (!str[0])
         continue;

      GtkWidget *button = gtk_button_new();
      GtkWidget *label = gtk_label_new(str);

      gtk_container_add(GTK_CONTAINER(button), label);
      set_label_font_size(label, gcin_font_size_symbol);

      gtk_container_set_border_width (GTK_CONTAINER (button), 0);
      gtk_box_pack_start (GTK_BOX (hbox_row), button, FALSE, FALSE, 0);

      if (utf8_str_N(str) > 0) {
        char phos[512];

        sym_lookup_key(str, phos);

        int phos_len = strlen(phos);

        if (phos_len) {
#if GTK_CHECK_VERSION(2,12,0)
          gtk_widget_set_tooltip_text (button, phos);
#else
          GtkTooltips *button_pho_tips = gtk_tooltips_new ();
          gtk_tooltips_set_tip (GTK_TOOLTIPS (button_pho_tips), button, phos, NULL);
#endif
        }
      }

      g_signal_connect (G_OBJECT (button), "clicked",  G_CALLBACK (cb_button_sym), label);
    }
  }

  gtk_box_pack_start (GTK_BOX (hbox_top), gtk_vseparator_new(), FALSE, FALSE, 0);

  GtkWidget *vbox_arrow = gtk_vbox_new (TRUE, 0);
  gtk_box_pack_start (GTK_BOX (hbox_top), vbox_arrow, TRUE, TRUE, 0);
  GtkWidget *eve_up=gtk_event_box_new(), *eve_down=gtk_event_box_new();
  gtk_box_pack_start (GTK_BOX (vbox_arrow), eve_up, TRUE, TRUE, 0);
  gtk_container_add(GTK_CONTAINER(eve_up), gtk_arrow_new(GTK_ARROW_UP, GTK_SHADOW_IN));
  gtk_box_pack_start (GTK_BOX (vbox_arrow), eve_down, TRUE, TRUE, 0);
  gtk_container_add(GTK_CONTAINER(eve_down), gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_IN));

  g_signal_connect(G_OBJECT(eve_up),"button-press-event", G_CALLBACK(mouse_button_callback_up_down), (gpointer)1);
  g_signal_connect(G_OBJECT(eve_down),"button-press-event", G_CALLBACK(mouse_button_callback_up_down), NULL);


  gtk_widget_realize (gwin_sym);
#if UNIX
  GdkWindow *gdkwin_sym = gtk_widget_get_window(gwin_sym);
  set_no_focus(gwin_sym);
#else
  win32_init_win(gwin_sym);
#endif

  if (win_sym_enabled)
    gtk_widget_show_all(gwin_sym);

  g_signal_connect (G_OBJECT (gwin_sym), "scroll-event", G_CALLBACK (button_scroll_event), NULL);

  move_win_sym();
#if 0
  dbg("in_method:%d\n", current_CS->in_method);
#endif
  return;
}