Пример #1
0
static void create_dialog(void)
{
        GtkWidget *vbox, *hbox, *vbox2, *notebook, *w;

        if (options_dialog)
                return;
        vbox = gtk_vbox_new(FALSE, 0);

        /* Buttons box */
        hbox = gtk_hbutton_box_new();
        gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
        gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END);

        /* Close button */
        w = gtk_button_new_with_label("Close");
        gtk_button_set_image(GTK_BUTTON(w),
                             gtk_image_new_from_stock(GTK_STOCK_CLOSE,
                                                      GTK_ICON_SIZE_BUTTON));
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(w), "clicked",
                         G_CALLBACK(close_dialog), NULL);

        gtk_box_pack_end(GTK_BOX(vbox), spacer_new(-1, 8), FALSE, TRUE, 0);

        /* Create notebook */
        notebook = gtk_notebook_new();
        gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);

        /* Colors page */
        vbox2 = gtk_vbox_new(FALSE, 0);
        w = gtk_label_new("Colors");
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox2, w);
        gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8);

        /* Colors -> Use style */
        w = check_button_new("Use default theme colors", &style_colors, FALSE);
        g_signal_connect(G_OBJECT(w), "toggled",
                         G_CALLBACK(style_colors_changed), NULL);
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* Colors -> Custom colors */
        gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0);
        color_table = create_color_table();
        gtk_box_pack_start(GTK_BOX(vbox2), color_table, FALSE, FALSE, 0);
        style_colors_changed();

        /* Unicode page */
        vbox2 = gtk_vbox_new(FALSE, 0);
        w = gtk_label_new("Languages");
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox2, w);
        gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8);

        /* Unicode -> Displayed blocks */
        w = label_new_markup("<b>Enabled Unicode blocks</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(-1, 4), FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);

        /* Unicode -> Blocks list */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = create_blocks_list();
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, TRUE, TRUE, 0);

        /* Recognition -> Duplicate glyphs */
        gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0);
        w = label_new_markup("<b>Language options</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* Unicode -> Disable Latin letters */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Disable Basic Latin letters",
                             &no_latin_alpha, TRUE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "If you have trained both the Basic Latin block "
                             "and a block with characters similar to Latin "
                             "letters (for instance, Cyrillic) you can disable "
                             "the Basic Latin letters in order to use only "
                             "numbers and symbols from Basic Latin.", NULL);

        /* Unicode -> Right-to-left */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Enable right-to-left mode",
                             &right_to_left, TRUE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             PACKAGE_NAME " will expect you to write from "
                             "the rightmost cell to the left and will pad "
                             "cells and create new lines accordingly.", NULL);

        /* Recognition page */
        vbox2 = gtk_vbox_new(FALSE, 0);
        gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8);
        w = gtk_label_new("Recognition");
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox2, w);

        /* Recognition -> Samples */
        w = label_new_markup("<b>Training samples</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* Recognition -> Samples -> Train on input */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Train on input when entering",
                             &train_on_input, FALSE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "When enabled, input characters will be used as "
                             "training samples when 'Enter' is pressed. This "
                             "is a good way to quickly build up many samples, "
                             "but can generate poor samples if your writing "
                             "gets sloppy.", NULL);

        /* Recognition -> Samples -> Maximum */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = label_new_markup("Samples per character: ");
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        w = spin_button_new_int(2, SAMPLES_MAX, &samples_max, FALSE);
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "The maximum number of training samples kept per "
                             "character. Lower this value if recognition is "
                             "too slow or the program uses too much memory.",
                             NULL);

        /* Recognition -> Word context */
        gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0);
        w = label_new_markup("<b>Word context</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* Recognition -> Word context -> English */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Enable English word context",
                             &wordfreq_enable, FALSE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "Use a dictionary of the most frequent English "
                             "words to assist recognition. Also aids in "
                             "consistent recognition of numbers and "
                             "capitalization.", NULL);

        /* Recognition -> Preprocessor */
        gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0);
        w = label_new_markup("<b>Preprocessor</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* Recognition -> Preprocessor -> Ignore stroke direction */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Ignore stroke direction",
                             &ignore_stroke_dir, FALSE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "Match input strokes with training sample strokes "
                             "that were drawn in the opposite direction. "
                             "Disabling this can boost recognition speed.",
                             NULL);

        /* Recognition -> Preprocessor -> Ignore stroke number */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Match differing stroke numbers",
                             &ignore_stroke_num, FALSE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "Match inputs to training samples that do not "
                             "have the same number of strokes. Disabling this "
                             "can boost recognition speed.", NULL);

        /* Create dialog window */
        options_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        g_signal_connect(G_OBJECT(options_dialog), "delete_event",
                         G_CALLBACK(gtk_widget_hide_on_delete), NULL);
        gtk_window_set_destroy_with_parent(GTK_WINDOW(options_dialog), TRUE);
        gtk_window_set_resizable(GTK_WINDOW(options_dialog), TRUE);
        gtk_window_set_title(GTK_WINDOW(options_dialog), "CellWriter Setup");
        gtk_container_set_border_width(GTK_CONTAINER(options_dialog), 8);
        gtk_container_add(GTK_CONTAINER(options_dialog), vbox);
        if (!window_embedded)
                gtk_window_set_transient_for(GTK_WINDOW(options_dialog),
                                             GTK_WINDOW(window));
}
Пример #2
0
static void create_dialog(void)
{
        GtkWidget *vbox, *hbox, *vbox2, *notebook, *w;

        if (options_dialog)
                return;
        vbox = gtk_vbox_new(FALSE, 0);

        /* Buttons box */
        hbox = gtk_hbutton_box_new();
        gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
        gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END);

#if GTK_CHECK_VERSION(2, 14, 0)
        /* Help button */
        gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_EDGE);
        w = gtk_button_new_from_stock(GTK_STOCK_HELP);
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(w), "clicked",
                         G_CALLBACK(help_clicked), NULL);
        gtk_tooltips_set_tip(tooltips, w, "Launch program website", NULL);
#endif

        /* Close button */
        w = gtk_button_new_with_label("Close");
        gtk_button_set_image(GTK_BUTTON(w),
                             gtk_image_new_from_stock(GTK_STOCK_CLOSE,
                                                      GTK_ICON_SIZE_BUTTON));
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        g_signal_connect(G_OBJECT(w), "clicked",
                         G_CALLBACK(close_dialog), NULL);

        gtk_box_pack_end(GTK_BOX(vbox), spacer_new(-1, 8), FALSE, TRUE, 0);

        /* Create notebook */
        notebook = gtk_notebook_new();
        gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);

        /* View page */
        vbox2 = gtk_vbox_new(FALSE, 0);
        gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8);
        w = gtk_label_new("Interface");
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox2, w);

        /* View -> Dimensions */
        w = label_new_markup("<b>Dimensions</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* View -> Dimensions -> Cell size */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = label_new_markup("Cells: ");
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        cell_width_spin = spin_button_new_int(CELL_WIDTH_MIN, cell_height,
                                              &cell_width, TRUE);
        g_signal_connect(G_OBJECT(cell_width_spin), "value-changed",
                         G_CALLBACK(cell_width_value_changed), NULL);
        gtk_box_pack_start(GTK_BOX(hbox), cell_width_spin, FALSE, FALSE, 0);
        w = label_new_markup(" by ");
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        cell_height_spin = spin_button_new_int(cell_width, CELL_HEIGHT_MAX,
                                               &cell_height, TRUE);
        cell_width_value_changed();
        g_signal_connect(G_OBJECT(cell_height_spin), "value-changed",
                         G_CALLBACK(cell_height_value_changed), NULL);
        gtk_box_pack_start(GTK_BOX(hbox), cell_height_spin, FALSE, FALSE, 0);
        w = label_new_markup(" pixels");
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);

        /* View -> Dimensions -> Grid */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = label_new_markup("Grid: ");
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        w = spin_button_new_int(6, 48, &cell_cols_pref, TRUE);
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        w = label_new_markup(" by ");
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        w = spin_button_new_int(1, 8, &cell_rows_pref, TRUE);
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        w = label_new_markup(" cells");
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);

        /* View -> Dimensions -> Keyboard size */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = label_new_markup("Keyboard: ");
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        w = spin_button_new_int(KEYBOARD_SIZE_MIN, 1400, &keyboard_size, TRUE);
        gtk_spin_button_set_increments(GTK_SPIN_BUTTON(w), 16, 4);
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        w = label_new_markup(" pixels wide");
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);

        /* View -> Window */
        gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0);
        w = label_new_markup("<b>Window</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* View -> Window -> Button labels */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Show button labels", &window_button_labels, TRUE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);

        /* View -> Window -> On-screen keyboard */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Show on-screen keyboard",
                             &keyboard_enabled, TRUE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);

        /* View -> Window -> Enable */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Enable extended input events",
                             &xinput_enabled, FALSE);
        g_signal_connect(G_OBJECT(w), "toggled",
                         G_CALLBACK(xinput_enabled_toggled), NULL);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "If you cannot write in the cells or the ink "
                             "does not appear where it should, you can try "
                             "disabling extended input events. Note that this "
                             "will disable the pen eraser.", NULL);

        /* View -> Window -> Docking */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = label_new_markup("Window docking: ");
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        w = gtk_combo_box_new_text();
        gtk_combo_box_append_text(GTK_COMBO_BOX(w), "Disabled");
        gtk_combo_box_append_text(GTK_COMBO_BOX(w), "Top");
        gtk_combo_box_append_text(GTK_COMBO_BOX(w), "Bottom");
        gtk_combo_box_set_active(GTK_COMBO_BOX(w), window_docked);
        g_signal_connect(G_OBJECT(w), "changed",
                         G_CALLBACK(window_docking_changed), NULL);
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);

        /* View -> Status icon */
        gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0);
        w = label_new_markup("<b>Status icon</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* View -> Status icon -> Enable */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Open menu on left click",
                             &status_menu_left_click, FALSE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);

        /* Colors page */
        vbox2 = gtk_vbox_new(FALSE, 0);
        w = gtk_label_new("Colors");
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox2, w);
        gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8);

        /* Colors -> Use style */
        w = check_button_new("Use default theme colors", &style_colors, FALSE);
        g_signal_connect(G_OBJECT(w), "toggled",
                         G_CALLBACK(style_colors_changed), NULL);
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* Colors -> Custom colors */
        gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0);
        color_table = create_color_table();
        gtk_box_pack_start(GTK_BOX(vbox2), color_table, FALSE, FALSE, 0);
        style_colors_changed();

        /* Unicode page */
        vbox2 = gtk_vbox_new(FALSE, 0);
        w = gtk_label_new("Languages");
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox2, w);
        gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8);

        /* Unicode -> Displayed blocks */
        w = label_new_markup("<b>Enabled Unicode blocks</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(-1, 4), FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);

        /* Unicode -> Blocks list */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = create_blocks_list();
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, TRUE, TRUE, 0);

        /* Recognition -> Duplicate glyphs */
        gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0);
        w = label_new_markup("<b>Language options</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* Unicode -> Disable Latin letters */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Disable Basic Latin letters",
                             &no_latin_alpha, TRUE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "If you have trained both the Basic Latin block "
                             "and a block with characters similar to Latin "
                             "letters (for instance, Cyrillic) you can disable "
                             "the Basic Latin letters in order to use only "
                             "numbers and symbols from Basic Latin.", NULL);

        /* Unicode -> Right-to-left */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Enable right-to-left mode",
                             &right_to_left, TRUE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             PACKAGE_NAME " will expect you to write from "
                             "the rightmost cell to the left and will pad "
                             "cells and create new lines accordingly.", NULL);

        /* Recognition page */
        vbox2 = gtk_vbox_new(FALSE, 0);
        gtk_container_set_border_width(GTK_CONTAINER(vbox2), 8);
        w = gtk_label_new("Recognition");
        gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox2, w);

        /* Recognition -> Samples */
        w = label_new_markup("<b>Training samples</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* Recognition -> Samples -> Train on input */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Train on input when entering",
                             &train_on_input, FALSE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "When enabled, input characters will be used as "
                             "training samples when 'Enter' is pressed. This "
                             "is a good way to quickly build up many samples, "
                             "but can generate poor samples if your writing "
                             "gets sloppy.", NULL);

        /* Recognition -> Samples -> Maximum */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = label_new_markup("Samples per character: ");
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        w = spin_button_new_int(2, SAMPLES_MAX, &samples_max, FALSE);
        gtk_box_pack_start(GTK_BOX(hbox), w, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "The maximum number of training samples kept per "
                             "character. Lower this value if recognition is "
                             "too slow or the program uses too much memory.",
                             NULL);

        /* Recognition -> Word context */
        gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0);
        w = label_new_markup("<b>Word context</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* Recognition -> Word context -> English */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Enable English word context",
                             &wordfreq_enable, FALSE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "Use a dictionary of the most frequent English "
                             "words to assist recognition. Also aids in "
                             "consistent recognition of numbers and "
                             "capitalization.", NULL);

        /* Recognition -> Preprocessor */
        gtk_box_pack_start(GTK_BOX(vbox2), spacer_new(-1, 8), FALSE, FALSE, 0);
        w = label_new_markup("<b>Preprocessor</b>");
        gtk_box_pack_start(GTK_BOX(vbox2), w, FALSE, FALSE, 0);

        /* Recognition -> Preprocessor -> Ignore stroke direction */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Ignore stroke direction",
                             &ignore_stroke_dir, FALSE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "Match input strokes with training sample strokes "
                             "that were drawn in the opposite direction. "
                             "Disabling this can boost recognition speed.",
                             NULL);

        /* Recognition -> Preprocessor -> Ignore stroke number */
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), spacer_new(16, -1), FALSE, FALSE, 0);
        w = check_button_new("Match differing stroke numbers",
                             &ignore_stroke_num, FALSE);
        gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0);
        gtk_tooltips_set_tip(tooltips, w,
                             "Match inputs to training samples that do not "
                             "have the same number of strokes. Disabling this "
                             "can boost recognition speed.", NULL);

        /* Create dialog window */
        options_dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        g_signal_connect(G_OBJECT(options_dialog), "delete_event",
                         G_CALLBACK(gtk_widget_hide_on_delete), NULL);
        gtk_window_set_destroy_with_parent(GTK_WINDOW(options_dialog), TRUE);
        gtk_window_set_resizable(GTK_WINDOW(options_dialog), TRUE);
        gtk_window_set_title(GTK_WINDOW(options_dialog), "CellWriter Setup");
        gtk_container_set_border_width(GTK_CONTAINER(options_dialog), 8);
        gtk_container_add(GTK_CONTAINER(options_dialog), vbox);
        if (!window_embedded)
                gtk_window_set_transient_for(GTK_WINDOW(options_dialog),
                                             GTK_WINDOW(window));
}