Beispiel #1
0
void show_win_pho()
{
//  dbg("show_win_pho\n");
  create_win_pho();
  create_win_pho_gui();

  if (hime_pop_up_win && !pho_has_input())
    return;

  if (!GTK_WIDGET_VISIBLE(gwin_pho))
  {
    gtk_widget_show(gwin_pho);
    move_win_pho(win_x, win_y);
  }

  gtk_widget_show(gwin_pho);
  if (current_CS->b_raise_window)
    gtk_window_present(GTK_WINDOW(gwin_pho));

  show_win_sym();

  if (pho_hide_row2)
    gtk_widget_hide(hbox_row2);
  else
    gtk_widget_show(hbox_row2);
}
Beispiel #2
0
void show_win0()
{
#if _DEBUG && 1
    dbg("show_win0 pop:%d in:%d for:%d \n", hime_pop_up_win, tsin_has_input(), force_show);
#endif
    create_win0();
    create_win0_gui();

    if (hime_pop_up_win && !tsin_has_input() && !force_show) {
//    dbg("show ret\n");
        return;
    }

#if 0
    if (!GTK_WIDGET_VISIBLE(gwin0))
#endif
    {
//    dbg("gtk_widget_show %x\n", gwin0);
        move_win0(win_x, win_y);
        gtk_widget_show(gwin0);
    }

    show_win_sym();

    if (current_CS->b_raise_window)
    {
        gtk_window_present(GTK_WINDOW(gwin0));
        raise_tsin_selection_win();
    }
}
Beispiel #3
0
void show_win_pho()
{
//  dbg("show_win_pho\n");
  create_win_pho();
  create_win_pho_gui();

  if (gcin_pop_up_win && !pho_has_input() &&
      inmd[default_input_method].method_type==method_type_PHO)
    return;

#if UNIX
  if (!GTK_WIDGET_VISIBLE(gwin_pho))
#endif
  {
    gtk_widget_show(gwin_pho);
    move_win_pho(win_x, win_y);
  }

  gtk_widget_show(gwin_pho);
#if UNIX
  if (current_CS->b_raise_window)
#endif
    gtk_window_present(GTK_WINDOW(gwin_pho));

  show_win_sym();

  if (pho_hide_row2)
    gtk_widget_hide(hbox_row2);
  else
    gtk_widget_show(hbox_row2);
}
Beispiel #4
0
void show_win0()
{
#if WIN32
  if (test_mode)
    return;
#endif

#if _DEBUG && 1
	dbg("show_win0 pop:%d in:%d for:%d win_xy:%d,%d\n", gcin_pop_up_win, tsin_has_input(), force_show, win_x, win_y);
#endif
  create_win0();
  create_win0_gui();

  if (gcin_pop_up_win && !tsin_has_input() && !force_show) {
//    dbg("show ret\n");
    return;
  }

#if WIN32
  compact_win0();
#endif

#if UNIX && 0
  if (!GTK_WIDGET_VISIBLE(gwin0))
#endif
  {
//    dbg("gtk_widget_show %x\n", gwin0);
#if UNIX
    move_win0(win_x, win_y);
    gtk_widget_show(gwin0);
#else
	move_win0(win_x, win_y);
    gtk_widget_show(gwin0);
//    move_win0(win_x, win_y);
#endif
  }

  show_win_sym();

#if UNIX
  if (current_CS->b_raise_window)
#endif
  {
    gtk_window_present(GTK_WINDOW(gwin0));
    raise_tsin_selection_win();
  }
}
Beispiel #5
0
void show_win_gtab()
{
  create_win_gtab();
  create_win_gtab_gui();
  // window was destroyed
  if (hime_pop_up_win)
    set_key_codes_label(str_key_codes, better_key_codes);

  if (current_CS) {
    if (current_CS->fixed_pos)
      move_win_gtab(0,0);
  }

//  init_gtab(current_CS->in_method);

  if (hime_pop_up_win && !gtab_has_input() &&
      !force_show && poo.same_pho_query_state==SAME_PHO_QUERY_none && !tss.pre_selN)
    return;

//  dbg("show_win_gtab()\n");

#if 0
  if (current_CS->b_raise_window)
#endif
    gtk_window_present(GTK_WINDOW(gwin_gtab));

  move_win_gtab(current_in_win_x, current_in_win_y);

  gtk_widget_show(gwin_gtab);

  if (current_CS)
  {
    if (current_CS->tsin_pho_mode==0)
      set_gtab_input_method_name(eng_half_str);
    else
      set_gtab_input_method_name(inmd[current_CS->in_method].cname);

    if (hime_status_tray || (! gtab_hide_row2))
      gtk_widget_hide(label_gtab);
    
    win_gtab_disp_half_full();
  }

  show_win_sym();
}
Beispiel #6
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;
}