#include "gcin.h" #include "pho.h" #include "config.h" #include GtkWidget *hbox_buttons; char current_str[MAX_PHRASE_LEN*CH_SZ+1]; PIN_JUYIN *pin_juyin; int pin_juyinN; PHOKBM phkbm; char inph[8]; u_char typ_pho[4]; int text_pho_N; gboolean b_pinyin; static GtkClipboard *pclipboard; GtkWidget *mainwin; GtkTextBuffer *buffer; void bell() { } void key_typ_pho(phokey_t phokey, u_char rtyp_pho[]) { } void do_exit() { exit(0); } #define MAX_SAME_PHO 32 void all_wrap() { GtkTextIter mstart,mend; gtk_text_buffer_get_bounds (buffer, &mstart, &mend); gtk_text_buffer_apply_tag_by_name (buffer, "char_wrap", &mstart, &mend); } char *phokey2pinyin(phokey_t k) { static char tt[32]; phokey_t tonemask = 7; int i; for(i=0; i < pin_juyinN; i++) { if ((k & ~tonemask) == pin_juyin[i].key) break; } if (i==pin_juyinN) strcpy(tt, "??"); else { static char tone[2]; tone[0] = (k & tonemask) + '0'; strcpy(tt, pin_juyin[i].pinyin); if (tone[0]!='0') strcat(tt, tone); } return tt; } static void selection_received(GtkClipboard *pclip, const gchar *text, gpointer data) { if (!text) return; char *outtext = NULL; int outlen = 0; while (*text) { char tt[CH_SZ * 5 * MAX_SAME_PHO + 1]; int len = u8cpy(tt, (char *)text); tt[len]=0; phokey_t phokeys[MAX_SAME_PHO]; int phokeysN = utf8_pho_keys((char *)text, phokeys); int i; for(i=0; i