Example #1
0
void win_gtab_disp_half_full()
{
  if (label_full) {
    if ((current_CS->im_state == HIME_STATE_CHINESE && (!current_CS->b_half_full_char)) ||
        (current_CS->tsin_pho_mode == 0))
      gtk_widget_hide(label_full);
    else
      gtk_widget_show(label_full);
  }

  if (current_CS->tsin_pho_mode)
  {
    if (label_gtab_sele) gtk_widget_show(label_gtab_sele);
    if (hime_status_tray || (! gtab_hide_row2))
      gtk_widget_show(label_gtab);
  }
  else
  {
    if (label_gtab_sele) gtk_widget_hide(label_gtab_sele);
    if (hime_status_tray || (! gtab_hide_row2))
      gtk_widget_hide(label_gtab);
  }

  if (label_gtab && (gtab_hide_row2))
  {
    if (hime_win_color_use)
      gtk_label_set_markup(GTK_LABEL(label_gtab), get_full_str());
    else
      gtk_label_set_text(GTK_LABEL(label_gtab), get_full_str());
  }

  minimize_win_gtab();
}
Example #2
0
void disp_gtab_pre_sel(char *s)
{
//  dbg("disp_gtab_pre_sel %s\n", s);
  if (!label_gtab_pre_sel)
    show_win_gtab();

//  dbg("label_gtab_pre_sel %x %d\n", label_gtab_pre_sel, use_tsin_sel_win());
  gtk_widget_show(label_gtab_pre_sel);
  gtk_label_set_markup(GTK_LABEL(label_gtab_pre_sel), s);
  minimize_win_gtab();
  show_win_gtab();
  adj_gtab_win_pos();
}
Example #3
0
void hide_gtab_pre_sel()
{
  if (use_tsin_sel_win())
    hide_selections_win();

//  dbg("hide_gtab_pre_sel %d\n", tss.ctrl_pre_sel);
  tss.pre_selN = 0;
  tss.ctrl_pre_sel = FALSE;
  if (label_gtab_pre_sel)
    gtk_widget_hide(label_gtab_pre_sel);

  minimize_win_gtab();

  move_win_gtab(current_in_win_x, current_in_win_y);
  adj_gtab_win_pos();
}
Example #4
0
void win_gtab_disp_half_full()
{
  if (!gwin_gtab)
    return;
  if (label_full) {
    if ((current_CS->im_state == HIME_STATE_CHINESE && (!current_CS->b_half_full_char)) ||
        (current_CS->tsin_pho_mode == 0))
      gtk_widget_hide(label_full);
    else
      gtk_widget_show(label_full);
  }

  if (current_CS->tsin_pho_mode)
  {
    if (label_gtab_sele) gtk_widget_show(label_gtab_sele);
    if (hime_status_tray || (! gtab_hide_row2))
      if (GTK_IS_WIDGET(label_gtab)) gtk_widget_show(label_gtab);
  }
  else
  {
    if (label_gtab_sele) gtk_widget_hide(label_gtab_sele);
    if (hime_status_tray || (! gtab_hide_row2))
      if (label_gtab) gtk_widget_hide(label_gtab);
  }

  if (gtab_hide_row2)
  {
    if (GTK_IS_WIDGET(label_gtab))
    {
      if (hime_win_color_use) gtk_label_set_markup(GTK_LABEL(label_gtab), get_full_str());
      else  gtk_label_set_text(GTK_LABEL(label_gtab), get_full_str());
    }
    else
    {
      gchar *full_str = get_full_str();
      if (full_str && full_str[0])
        disp_gtab_sel(full_str);
      else
        disp_gtab_sel(inmd[current_CS->in_method].cname);
    }
  }

  minimize_win_gtab();
}
Example #5
0
static void DispInArea()
{
  int i;

//  hide_gtab_pre_sel();

//  dbg("sel1st:%d\n", ggg.sel1st_i);
  if (hime_display_on_the_spot_key()) {
    if (gwin_gtab && GTK_WIDGET_VISIBLE(gwin_gtab) && poo.same_pho_query_state == SAME_PHO_QUERY_none)
      hide_win_gtab();
    return;
  }

  char tt[128];
  int ttN=0;

  if (win_gtab_max_key_press < ggg.ci)
    win_gtab_max_key_press = ggg.ci;

  for(i=0;i<ggg.ci;i++) {
    char *p=(char *)&cur_inmd->keyname[ggg.inch[i] * CH_SZ];
    int len;
    if (*p & 0x80)
      len=utf8cpy(tt+ttN, p);
    else {
      len = strlen(p);
      strcpy(tt+ttN, p);
    }

    ttN+=len;
  }

  tt[ttN]=0;

  gtab_disp_empty(tt, win_gtab_max_key_press - i);

  disp_gtab(tt);
  minimize_win_gtab();
}
Example #6
0
void disp_gtab_sel(char *s)
{
//  dbg("disp_gtab_sel '%s' %x\n", s, label_gtab_sele);

  if (!label_gtab_sele) {
    if (s && *s)
      show_win_gtab();
    else
      return;
  }

  if (!s[0])
    gtk_widget_hide(label_gtab_sele);
  else {
    if (gwin_gtab && !GTK_WIDGET_VISIBLE(gwin_gtab))
       show_win_gtab();
    gtk_widget_show(label_gtab_sele);
  }

//  dbg("disp_gtab_sel '%s'\n", s);
  gtk_label_set_markup(GTK_LABEL(label_gtab_sele), s);
  minimize_win_gtab();
  adj_gtab_win_pos();
}
Example #7
0
void create_win_gtab_gui_simple()
{
//  dbg("create_win_gtab_gui ..... %d, %d\n", current_CS->use_preedit, hime_edit_display);

  destroy_if_necessary();

  if (top_bin)
    return;

//  dbg("create_win_gtab_gui_simple\n");

  last_cursor_off = FALSE;

  GtkWidget *vbox_top = gtk_vbox_new (FALSE, 0);
  gtk_orientable_set_orientation(GTK_ORIENTABLE(vbox_top), GTK_ORIENTATION_VERTICAL);

  GtkWidget *event_box_gtab;
  if (gtab_in_area_button) {
    event_box_gtab = gtk_button_new();
#if 0
    GtkStyle *style = gtk_widget_get_style(event_box_gtab);
    style->xthickness =0;
    style->ythickness =0;
#endif
  } else {
    event_box_gtab = gtk_event_box_new();
    gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box_gtab), FALSE);
  }

  gtk_container_set_border_width (GTK_CONTAINER (event_box_gtab), 0);

  if (hime_inner_frame) {
    GtkWidget *frame = top_bin = gtk_frame_new(NULL);
    gtk_container_set_border_width (GTK_CONTAINER (frame), 0);
    gtk_container_add (GTK_CONTAINER(gwin_gtab), frame);
    gtk_container_set_border_width (GTK_CONTAINER (gwin_gtab), 0);
    gtk_container_add (GTK_CONTAINER (frame), vbox_top);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
  } else {
    gtk_container_add (GTK_CONTAINER(gwin_gtab), vbox_top);
    top_bin = vbox_top;
  }

  GtkWidget *hbox_edit = NULL;

  gboolean b_need_label_edit = need_label_edit();

  if (b_need_label_edit) {
    hbox_edit = gtk_hbox_new (FALSE, 0);
    gtk_container_add (GTK_CONTAINER (vbox_top), hbox_edit);
    GtkWidget *align_edit = gtk_alignment_new (0, 0.0, 0, 0);
    gtk_box_pack_start (GTK_BOX (hbox_edit), align_edit, FALSE, FALSE, 0);
    label_edit = gtk_label_new(NULL);
    gtk_container_add (GTK_CONTAINER (align_edit), label_edit);
  }

  GtkWidget *align = gtk_alignment_new (0, 0.0, 0, 0);

  label_gtab_sele = gtk_label_new(NULL);
  gtk_container_add (GTK_CONTAINER (align), label_gtab_sele);

  if (!gtab_in_row1) {
    if (!gtab_vertical_select_on())
      gtk_box_pack_start (GTK_BOX (vbox_top), align, FALSE, FALSE, 0);
  } else {
    GtkWidget *hbox_row1 = gtk_hbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox_top), hbox_row1, FALSE, FALSE, 0);

//    dbg("zzz %d zzz %d %d\n", b_need_label_edit, gtab_phrase_on(), hime_edit_display_ap_only());

    if (b_need_label_edit) {
      last_cursor_off = TRUE;
      gtk_box_pack_start (GTK_BOX (hbox_edit), event_box_gtab, FALSE, FALSE, 0);
    } else
      gtk_box_pack_start (GTK_BOX (hbox_row1), event_box_gtab, FALSE, FALSE, 0);

    if (!gtab_vertical_select_on())
      gtk_box_pack_start (GTK_BOX (hbox_row1), align, FALSE, FALSE, 0);
  }

  if (gtab_phrase_pre_select && !use_tsin_sel_win()) {
    label_gtab_pre_sel = gtk_label_new(NULL);
    set_label_font_size(label_gtab_pre_sel, hime_font_size_tsin_presel);
    gtk_box_pack_start (GTK_BOX (vbox_top), label_gtab_pre_sel, FALSE, FALSE, 0);
  }

  hbox_row2 = gtk_hbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (vbox_top), hbox_row2);

  label_full = gtk_label_new(NULL);
  gtk_label_set_markup(GTK_LABEL(label_full), _(cht_full_str));

  gtk_box_pack_start (GTK_BOX (hbox_row2), label_full, FALSE, FALSE, 0);


  if (gtab_disp_im_name) {
    GtkWidget *event_box_input_method_name;
    if (gtab_in_area_button)
      event_box_input_method_name = gtk_button_new();
    else {
      event_box_input_method_name = gtk_event_box_new();
      gtk_event_box_set_visible_window (GTK_EVENT_BOX(event_box_input_method_name), FALSE);
    }

    gtk_box_pack_start (GTK_BOX (hbox_row2), event_box_input_method_name, FALSE, FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (event_box_input_method_name), 0);

    GtkWidget *frame_input_method_name = NULL;
    if (!gtab_in_area_button) {
    frame_input_method_name = gtk_frame_new(NULL);
    gtk_frame_set_shadow_type(GTK_FRAME(frame_input_method_name), GTK_SHADOW_OUT);
    gtk_container_add (GTK_CONTAINER (event_box_input_method_name), frame_input_method_name);
    gtk_container_set_border_width (GTK_CONTAINER (frame_input_method_name), 0);
    }

    label_input_method_name = gtk_label_new("");
  //  dbg("gtk_label_new label_input_method_name\n");

    gtk_container_add (GTK_CONTAINER (gtab_in_area_button?event_box_input_method_name:frame_input_method_name), label_input_method_name);
    g_signal_connect_swapped (GTK_OBJECT (event_box_input_method_name), "button-press-event",
          G_CALLBACK (inmd_switch_popup_handler), NULL);

    box_gtab_im_name = event_box_input_method_name;
  }

  if (!gtab_in_row1)
    gtk_box_pack_start (GTK_BOX (hbox_row2), event_box_gtab, FALSE, FALSE, 0);


  if (!hime_display_on_the_spot_key()) {
    GtkWidget *frame_gtab = NULL;
    if (!gtab_in_area_button) {
      frame_gtab = gtk_frame_new(NULL);
      gtk_frame_set_shadow_type(GTK_FRAME(frame_gtab), GTK_SHADOW_OUT);
      gtk_container_set_border_width (GTK_CONTAINER (frame_gtab), 0);
      gtk_container_add (GTK_CONTAINER (event_box_gtab), frame_gtab);
    }
    g_signal_connect(G_OBJECT(event_box_gtab),"button-press-event",
                     G_CALLBACK(mouse_button_callback), NULL);

#if 0
    if (left_right_button_tips) {
#if GTK_CHECK_VERSION(2,12,0)
      gtk_widget_set_tooltip_text (event_box_gtab, _("左鍵符號,右鍵設定"));
#else
      GtkTooltips *button_gtab_tips = gtk_tooltips_new ();
      gtk_tooltips_set_tip (GTK_TOOLTIPS (button_gtab_tips), event_box_gtab, _("左鍵符號,右鍵設定"),NULL);
#endif
    }
#endif


    label_gtab = gtk_label_new(NULL);

    if (gtab_in_area_button)
      gtk_container_add (GTK_CONTAINER (event_box_gtab), label_gtab);
    else
      gtk_container_add (GTK_CONTAINER (frame_gtab), label_gtab);
  }

  label_key_codes  = gtk_label_new(NULL);
#if 0
  gtk_label_set_selectable(GTK_LABEL(label_key_codes), TRUE);
  mod_bg_all(label_key_codes, NULL);
#endif
  gtk_box_pack_start (GTK_BOX (hbox_row2), label_key_codes, FALSE, FALSE, 2);

  label_page  = gtk_label_new(NULL);
  gtk_box_pack_start (GTK_BOX (hbox_row2), label_page, FALSE, FALSE, 2);

  if (gtab_vertical_select_on()) {
    gtk_box_pack_start (GTK_BOX (vbox_top), align, FALSE, FALSE, 0);
  }

  change_gtab_font_size();

  gtk_widget_show_all (gwin_gtab);
  gtk_widget_hide (gwin_gtab);
  gtk_widget_hide(label_gtab_sele);
  gtk_widget_hide(label_key_codes);
  gtk_widget_hide(label_page);
  if (label_gtab_pre_sel)
    gtk_widget_hide(label_gtab_pre_sel);

  show_hide_label_edit();

  set_disp_im_name();
  gtk_widget_hide(label_full);

  if (gtab_hide_row2)
    gtk_widget_hide(hbox_row2);

  minimize_win_gtab();
}
Example #8
0
void ClrSelArea()
{
  disp_gtab_sel("");
  minimize_win_gtab();
//  hide_gtab_pre_sel();
}