?? window.c
字號(hào):
/* Insert button */ insert_button = gtk_button_new_with_label("Enter"); gtk_button_set_focus_on_click(GTK_BUTTON(insert_button), FALSE); gtk_button_set_image(GTK_BUTTON(insert_button), gtk_image_new_from_stock(GTK_STOCK_OK, GTK_ICON_SIZE_BUTTON)); gtk_button_set_relief(GTK_BUTTON(insert_button), GTK_RELIEF_NONE); gtk_box_pack_start(GTK_BOX(bottom_box), insert_button, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(insert_button), "clicked", G_CALLBACK(insert_button_clicked), 0); gtk_tooltips_set_tip(tooltips, insert_button, "Insert input or press Enter key", NULL); /* Back buffer button */ buffer_button = gtk_toggle_button_new(); gtk_button_set_focus_on_click(GTK_BUTTON(buffer_button), FALSE); button_set_image_xpm(buffer_button, tab_xpm); gtk_button_set_relief(GTK_BUTTON(buffer_button), GTK_RELIEF_NONE); gtk_box_pack_start(GTK_BOX(bottom_box), buffer_button, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(buffer_button), "pressed", G_CALLBACK(buffer_button_pressed), NULL); gtk_tooltips_set_tip(tooltips, buffer_button, "Recall previously entered input", NULL); gtk_widget_set_sensitive(buffer_button, FALSE); /* Pack the regular bottom box */ gtk_box_pack_start(GTK_BOX(window_vbox), bottom_box, FALSE, FALSE, 0); if (!keyboard_only) gtk_widget_show_all(bottom_box); /* Update button labels */ toggle_button_labels(window_button_labels); /* Set window style */ window_style_set(window); if (window_embedded) { /* Embedding in a screensaver won't let us popup new windows */ gtk_widget_hide(buffer_button); gtk_widget_hide(train_button); gtk_widget_hide(setup_button); /* If we are embedded we need to print the plug's window XID */ g_signal_connect_after(G_OBJECT(window), "realize", G_CALLBACK(print_window_xid), NULL); gtk_container_add(GTK_CONTAINER(window), window_vbox); gtk_widget_show(window); return; } /* Non-embedded window configuration */ gtk_container_add(GTK_CONTAINER(window), window_vbox); gtk_window_set_keep_above(GTK_WINDOW(window), TRUE); gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_UTILITY); gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME); gtk_window_set_skip_pager_hint(GTK_WINDOW(window), TRUE); gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window), TRUE); gtk_window_set_decorated(GTK_WINDOW(window), TRUE); gtk_window_stick(GTK_WINDOW(window)); /* Coordinates passed on the command-line */ if (window_force_x >= 0) window_frame.x = window_force_x; if (window_force_y >= 0) window_frame.y = window_force_y; /* Center window on initial startup */ screen = gtk_window_get_screen(GTK_WINDOW(window)); if (window_frame.x < 0) window_frame.x = gdk_screen_get_width(screen) / 2; if (window_frame.y < 0) window_frame.y = gdk_screen_get_height(screen) * 3 / 4; gtk_window_move(GTK_WINDOW(window), window_frame.x, window_frame.y); /* Create status icon */ status_icon_create(); /* Set the window size */ if (window_force_docked >= WINDOW_UNDOCKED) window_docked = window_force_docked; if (window_docked) { int mode; mode = window_docked; window_docked = WINDOW_UNDOCKED; window_set_docked(mode); } /* Show window */ if (window_force_hide) window_shown = FALSE; else if (window_force_show) window_shown = TRUE; if (window_shown || !status_icon_embedded()) gtk_widget_show(window);}void window_sync(void)/* Sync data with profile, do not change item order! */{ profile_write("window"); /* Docking the window will mess up the desired natural frame */ if (!profile_read_only && window_docked) { profile_sync_int(&window_frame_saved.x); profile_sync_int(&window_frame_saved.y); } else { profile_sync_int(&window_frame.x); profile_sync_int(&window_frame.y); } profile_sync_int(&training_block); profile_sync_int(&window_shown); profile_sync_int(&window_button_labels); profile_sync_int(&keyboard_size); profile_sync_int(&window_docked); profile_write("\n");}void window_cleanup(void){ key_widget_cleanup(key_widget);}/* Unicode blocks*//* This table is based on unicode-blocks.h from the gucharmap project */UnicodeBlock unicode_blocks[] ={ { TRUE, 0x0000, 0x007F, "Basic Latin" }, { TRUE, 0x0080, 0x00FF, "Latin-1 Supplement" }, { FALSE, 0x0100, 0x017F, "Latin Extended-A" }, { FALSE, 0x0180, 0x024F, "Latin Extended-B" }, { FALSE, 0x0250, 0x02AF, "IPA Extensions" }, { FALSE, 0x02B0, 0x02FF, "Spacing Modifier Letters" }, { FALSE, 0x0300, 0x036F, "Combining Diacritical Marks" }, { FALSE, 0x0370, 0x03FF, "Greek and Coptic" }, { FALSE, 0x0400, 0x04FF, "Cyrillic" }, { FALSE, 0x0500, 0x052F, "Cyrillic Supplement" }, { FALSE, 0x0530, 0x058F, "Armenian" }, { FALSE, 0x0590, 0x05FF, "Hebrew" }, { FALSE, 0x0600, 0x06FF, "Arabic" }, { FALSE, 0x0700, 0x074F, "Syriac" }, { FALSE, 0x0750, 0x077F, "Arabic Supplement" }, { FALSE, 0x0780, 0x07BF, "Thaana" }, { FALSE, 0x07C0, 0x07FF, "N'Ko" }, { FALSE, 0x0900, 0x097F, "Devanagari" }, { FALSE, 0x0980, 0x09FF, "Bengali" }, { FALSE, 0x0A00, 0x0A7F, "Gurmukhi" }, { FALSE, 0x0A80, 0x0AFF, "Gujarati" }, { FALSE, 0x0B00, 0x0B7F, "Oriya" }, { FALSE, 0x0B80, 0x0BFF, "Tamil" }, { FALSE, 0x0C00, 0x0C7F, "Telugu" }, { FALSE, 0x0C80, 0x0CFF, "Kannada" }, { FALSE, 0x0D00, 0x0D7F, "Malayalam" }, { FALSE, 0x0D80, 0x0DFF, "Sinhala" }, { FALSE, 0x0E00, 0x0E7F, "Thai" }, { FALSE, 0x0E80, 0x0EFF, "Lao" }, { FALSE, 0x0F00, 0x0FFF, "Tibetan" }, { FALSE, 0x1000, 0x109F, "Myanmar" }, { FALSE, 0x10A0, 0x10FF, "Georgian" }, { FALSE, 0x1100, 0x11FF, "Hangul Jamo" }, { FALSE, 0x1200, 0x137F, "Ethiopic" }, { FALSE, 0x1380, 0x139F, "Ethiopic Supplement" }, { FALSE, 0x13A0, 0x13FF, "Cherokee" }, { FALSE, 0x1400, 0x167F, "Unified Canadian Aboriginal Syllabics" }, { FALSE, 0x1680, 0x169F, "Ogham" }, { FALSE, 0x16A0, 0x16FF, "Runic" }, { FALSE, 0x1700, 0x171F, "Tagalog" }, { FALSE, 0x1720, 0x173F, "Hanunoo" }, { FALSE, 0x1740, 0x175F, "Buhid" }, { FALSE, 0x1760, 0x177F, "Tagbanwa" }, { FALSE, 0x1780, 0x17FF, "Khmer" }, { FALSE, 0x1800, 0x18AF, "Mongolian" }, { FALSE, 0x1900, 0x194F, "Limbu" }, { FALSE, 0x1950, 0x197F, "Tai Le" }, { FALSE, 0x1980, 0x19DF, "New Tai Lue" }, { FALSE, 0x19E0, 0x19FF, "Khmer Symbols" }, { FALSE, 0x1A00, 0x1A1F, "Buginese" }, { FALSE, 0x1B00, 0x1B7F, "Balinese" }, { FALSE, 0x1D00, 0x1D7F, "Phonetic Extensions" }, { FALSE, 0x1D80, 0x1DBF, "Phonetic Extensions Supplement" }, { FALSE, 0x1DC0, 0x1DFF, "Combining Diacritical Marks Supplement" }, { FALSE, 0x1E00, 0x1EFF, "Latin Extended Additional" }, { FALSE, 0x1F00, 0x1FFF, "Greek Extended" }, { FALSE, 0x2000, 0x206F, "General Punctuation" }, { FALSE, 0x2070, 0x209F, "Superscripts and Subscripts" }, { FALSE, 0x20A0, 0x20CF, "Currency Symbols" }, { FALSE, 0x20D0, 0x20FF, "Combining Diacritical Marks for Symbols" }, { FALSE, 0x2100, 0x214F, "Letterlike Symbols" }, { FALSE, 0x2150, 0x218F, "Number Forms" }, { FALSE, 0x2190, 0x21FF, "Arrows" }, { FALSE, 0x2200, 0x22FF, "Mathematical Operators" }, { FALSE, 0x2300, 0x23FF, "Miscellaneous Technical" }, { FALSE, 0x2400, 0x243F, "Control Pictures" }, { FALSE, 0x2440, 0x245F, "Optical Character Recognition" }, { FALSE, 0x2460, 0x24FF, "Enclosed Alphanumerics" }, { FALSE, 0x2500, 0x257F, "Box Drawing" }, { FALSE, 0x2580, 0x259F, "Block Elements" }, { FALSE, 0x25A0, 0x25FF, "Geometric Shapes" }, { FALSE, 0x2600, 0x26FF, "Miscellaneous Symbols" }, { FALSE, 0x2700, 0x27BF, "Dingbats" }, { FALSE, 0x27C0, 0x27EF, "Miscellaneous Mathematical Symbols-A" }, { FALSE, 0x27F0, 0x27FF, "Supplemental Arrows-A" }, { FALSE, 0x2800, 0x28FF, "Braille Patterns" }, { FALSE, 0x2900, 0x297F, "Supplemental Arrows-B" }, { FALSE, 0x2980, 0x29FF, "Miscellaneous Mathematical Symbols-B" }, { FALSE, 0x2A00, 0x2AFF, "Supplemental Mathematical Operators" }, { FALSE, 0x2B00, 0x2BFF, "Miscellaneous Symbols and Arrows" }, { FALSE, 0x2C00, 0x2C5F, "Glagolitic" }, { FALSE, 0x2C60, 0x2C7F, "Latin Extended-C" }, { FALSE, 0x2C80, 0x2CFF, "Coptic" }, { FALSE, 0x2D00, 0x2D2F, "Georgian Supplement" }, { FALSE, 0x2D30, 0x2D7F, "Tifinagh" }, { FALSE, 0x2D80, 0x2DDF, "Ethiopic Extended" }, { FALSE, 0x2E00, 0x2E7F, "Supplemental Punctuation" }, { FALSE, 0x2E80, 0x2EFF, "CJK Radicals Supplement" }, { FALSE, 0x2F00, 0x2FDF, "Kangxi Radicals" }, { FALSE, 0x2FF0, 0x2FFF, "Ideographic Description Characters" }, { FALSE, 0x3000, 0x303F, "CJK Symbols and Punctuation" }, { FALSE, 0x3040, 0x309F, "Hiragana" }, { FALSE, 0x30A0, 0x30FF, "Katakana" }, { FALSE, 0x3100, 0x312F, "Bopomofo" }, { FALSE, 0x3130, 0x318F, "Hangul Compatibility Jamo" }, { FALSE, 0x3190, 0x319F, "Kanbun" }, { FALSE, 0x31A0, 0x31BF, "Bopomofo Extended" }, { FALSE, 0x31C0, 0x31EF, "CJK Strokes" }, { FALSE, 0x31F0, 0x31FF, "Katakana Phonetic Extensions" }, { FALSE, 0x3200, 0x32FF, "Enclosed CJK Letters and Months" }, { FALSE, 0x3300, 0x33FF, "CJK Compatibility" }, { FALSE, 0x3400, 0x4DBF, "CJK Unified Ideographs Extension A" }, { FALSE, 0x4DC0, 0x4DFF, "Yijing Hexagram Symbols" }, { FALSE, 0x4E00, 0x9FFF, "CJK Unified Ideographs" }, { FALSE, 0xA000, 0xA48F, "Yi Syllables" }, { FALSE, 0xA490, 0xA4CF, "Yi Radicals" }, { FALSE, 0xA700, 0xA71F, "Modifier Tone Letters" }, { FALSE, 0xA720, 0xA7FF, "Latin Extended-D" }, { FALSE, 0xA800, 0xA82F, "Syloti Nagri" }, { FALSE, 0xA840, 0xA87F, "Phags-pa" }, { FALSE, 0xAC00, 0xD7AF, "Hangul Syllables" }, { FALSE, 0xD800, 0xDB7F, "High Surrogates" }, { FALSE, 0xDB80, 0xDBFF, "High Private Use Surrogates" }, { FALSE, 0xDC00, 0xDFFF, "Low Surrogates" }, { FALSE, 0xE000, 0xF8FF, "Private Use Area" }, { FALSE, 0xF900, 0xFAFF, "CJK Compatibility Ideographs" }, { FALSE, 0xFB00, 0xFB4F, "Alphabetic Presentation Forms" }, { FALSE, 0xFB50, 0xFDFF, "Arabic Presentation Forms-A" }, { FALSE, 0xFE00, 0xFE0F, "Variation Selectors" }, { FALSE, 0xFE10, 0xFE1F, "Vertical Forms" }, { FALSE, 0xFE20, 0xFE2F, "Combining Half Marks" }, { FALSE, 0xFE30, 0xFE4F, "CJK Compatibility Forms" }, { FALSE, 0xFE50, 0xFE6F, "Small Form Variants" }, { FALSE, 0xFE70, 0xFEFF, "Arabic Presentation Forms-B" }, { FALSE, 0xFF00, 0xFFEF, "Halfwidth and Fullwidth Forms" }, { FALSE, 0xFFF0, 0xFFFF, "Specials" }, /* Cut the table here because we only support 4-byte characters */ { FALSE, 0, 0, NULL },};void blocks_sync(void){ UnicodeBlock *block; profile_write("blocks"); block = unicode_blocks; while (block->name) { profile_sync_short(&block->enabled); block++; } profile_write("\n");}void unicode_block_toggle(int block, int on){ int pos, active, training_block_saved; if (block < 0 || unicode_blocks[block].enabled == on) return; unicode_blocks[block].enabled = on; active = gtk_combo_box_get_active(GTK_COMBO_BOX(blocks_combo)); pos = block_unicode_to_combo(block); training_block_saved = training_block; if (!on) gtk_combo_box_remove_text(GTK_COMBO_BOX(blocks_combo), pos); else gtk_combo_box_insert_text(GTK_COMBO_BOX(blocks_combo), pos, unicode_blocks[block].name); update_enabled_samples(); if ((!on && block <= training_block_saved) || active < 0) gtk_combo_box_set_active(GTK_COMBO_BOX(blocks_combo), active > 0 ? active - 1 : 0); /* Are we out of blocks? */ if (gtk_combo_box_get_active(GTK_COMBO_BOX(blocks_combo)) < 0) { training_block = -1; cell_widget_train(); }}/* Start-up message dialog*/#define WELCOME_MSG "You are either starting " PACKAGE_NAME " for the first " \ "time or have not yet created any training samples.\n\n" \ PACKAGE_NAME " requires accurate training samples of " \ "your characters before it can work.\n\n" \ PACKAGE_NAME " will now enter training mode. " \ "Carefully draw each character in its cell and then " \ "press the 'Train' button."void startup_splash_show(void){ GtkWidget *dialog; dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Welcome to " PACKAGE_STRING "!"); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), WELCOME_MSG); gtk_window_set_title(GTK_WINDOW(dialog), "Welcome to " PACKAGE_NAME "!"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); /* Press in the training button for the user */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(train_button), TRUE);}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -