static void wpa_trace_bfd_init(void) { if (!prg_fname) { get_prg_fname(); if (!prg_fname) return; } if (!cached_abfd) { cached_abfd = open_bfd(prg_fname); if (!cached_abfd) { wpa_printf(MSG_INFO, "Failed to open bfd"); return; } } read_syms(cached_abfd); if (!syms) { wpa_printf(MSG_INFO, "Failed to read symbols"); return; } }
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; }