G_MODULE_EXPORT void _add_and_check_global_opts(GladeXML *gxml, #endif const gchar *mod_name, GtkWidget *submenu, DIALOG_DATA *d) { GtkWidget *item; GLOBAL_OPS *ops = NULL; gint modtype = main_get_mod_type((gchar *)(is_dialog ? d->mod_name : mod_name)); ops = main_new_globals((gchar *)mod_name); item = UI_GET_ITEM(gxml, "verse_per_line"); if (mod_name && (modtype == TEXT_TYPE)) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->verse_per_line); } item = UI_GET_ITEM(gxml, "words_of_christ_in_red"); if ((main_check_for_global_option((gchar *)mod_name, "GBFRedLetterWords")) || (main_check_for_global_option((gchar *)mod_name, "OSISRedLetterWords"))) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->words_in_red); } item = UI_GET_ITEM(gxml, "strongs_numbers"); if ((main_check_for_global_option((gchar *)mod_name, "GBFStrongs")) || (main_check_for_global_option((gchar *)mod_name, "ThMLStrongs")) || (main_check_for_global_option((gchar *)mod_name, "OSISStrongs"))) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->strongs); } item = UI_GET_ITEM(gxml, "morphological_tags"); if (main_check_for_global_option((gchar *)mod_name, "GBFMorph") || main_check_for_global_option((gchar *)mod_name, "ThMLMorph") || main_check_for_global_option((gchar *)mod_name, "OSISMorph")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->morphs); } item = UI_GET_ITEM(gxml, "footnotes"); if (main_check_for_global_option((gchar *)mod_name, "GBFFootnotes") || main_check_for_global_option((gchar *)mod_name, "ThMLFootnotes") || main_check_for_global_option((gchar *)mod_name, "OSISFootnotes")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->footnotes); } item = UI_GET_ITEM(gxml, "greek_accents"); if (main_check_for_global_option((gchar *)mod_name, "UTF8GreekAccents")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->greekaccents); } item = UI_GET_ITEM(gxml, "lemmas"); if (main_check_for_global_option((gchar *)mod_name, "ThMLLemma") || main_check_for_global_option((gchar *)mod_name, "OSISLemma")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->lemmas); } item = UI_GET_ITEM(gxml, "cross-references"); if (main_check_for_global_option((gchar *)mod_name, "ThMLScripref") || main_check_for_global_option((gchar *)mod_name, "OSISScripref")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->scripturerefs); } item = UI_GET_ITEM(gxml, "hebrew_vowel_points"); if (main_check_for_global_option((gchar *)mod_name, "UTF8HebrewPoints")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->hebrewpoints); } item = UI_GET_ITEM(gxml, "hebrew_cantillation"); if (main_check_for_global_option((gchar *)mod_name, "UTF8Cantillation")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->hebrewcant); } item = UI_GET_ITEM(gxml, "headings"); if (main_check_for_global_option((gchar *)mod_name, "ThMLHeadings") || main_check_for_global_option((gchar *)mod_name, "OSISHeadings")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->headings); } item = UI_GET_ITEM(gxml, "transliteration"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->transliteration); item = UI_GET_ITEM(gxml, "variants"); if (main_check_for_global_option((gchar *)mod_name, "ThMLVariants") || main_check_for_global_option((gchar *)mod_name, "OSISVariants")) { gtk_widget_show(item); item = UI_GET_ITEM(gxml, "primary_reading"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->variants_primary); item = UI_GET_ITEM(gxml, "secondary_reading"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->variants_secondary); item = UI_GET_ITEM(gxml, "all_readings"); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->variants_all); } item = UI_GET_ITEM(gxml, "xlit"); if (main_check_for_global_option((gchar *)mod_name, "OSISXlit")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->xlit); } item = UI_GET_ITEM(gxml, "enumerated"); if (main_check_for_global_option((gchar *)mod_name, "OSISEnum")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->enumerated); } item = UI_GET_ITEM(gxml, "glosses"); if (main_check_for_global_option((gchar *)mod_name, "OSISGlosses") || main_check_for_global_option((gchar *)mod_name, "OSISRuby")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->glosses); } item = UI_GET_ITEM(gxml, "morphseg"); if (main_check_for_global_option((gchar *)mod_name, "OSISMorphSegmentation")) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->morphseg); } item = UI_GET_ITEM(gxml, "image_content"); if (ops->image_content != -1) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->image_content); } item = UI_GET_ITEM(gxml, "respect_font_faces"); if (ops->respect_font_faces != -1) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->respect_font_faces); } item = UI_GET_ITEM(gxml, "commentary_by_chapter"); if ((modtype == COMMENTARY_TYPE) || (modtype == PERCOM_TYPE)) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->commentary_by_chapter); } item = UI_GET_ITEM(gxml, "doublespace"); #ifdef USE_GTK_3 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->doublespace); #else GTK_CHECK_MENU_ITEM(item)->active = ops->doublespace; #endif item = UI_GET_ITEM(gxml, "xrefnotenumbers"); if ((ops->scripturerefs && (main_check_for_global_option((gchar *)mod_name, "ThMLScripref") || main_check_for_global_option((gchar *)mod_name, "OSISScripref"))) || (ops->footnotes && (main_check_for_global_option((gchar *)mod_name, "ThMLFootnotes") || main_check_for_global_option((gchar *)mod_name, "OSISFootnotes") || main_check_for_global_option((gchar *)mod_name, "GBFFootnotes")))) { gtk_widget_show(item); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), ops->xrefnotenumbers); } else { gtk_widget_hide(item); } g_free(ops); }
static gboolean on_vbox1_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { /* these are the mods we actually use for global keys, we always only check for these set */ guint state = event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_MOD4_MASK); switch (event->keyval) { case XK_Shift_L: /* shift keys - we need this for locking strongs (and */ case XK_Shift_R: /* other stuff) while moving mouse to previewer */ shift_key_pressed = TRUE; /* no break? hm... */ case XK_a: case XK_A: if (state == GDK_MOD1_MASK) { // Alt-A annotation gui_mark_verse_dialog(sM, sV); } else if (state == (GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_SHIFT_MASK)) on_biblesync_kbd(3); // BSP audience break; case XK_b: case XK_B: if (state == GDK_MOD1_MASK) { // Alt-B bookmark gchar *label = g_strdup_printf("%s, %s", sV, sM); gui_bookmark_dialog(label, sM, sV); g_free(label); } break; case XK_c: case XK_C: if (state == GDK_MOD1_MASK) { // Alt-C commentary pane gtk_widget_grab_focus(navbar_versekey.lookup_entry); gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets.notebook_comm_book), 0); } break; case XK_d: case XK_D: if (state == GDK_MOD1_MASK) // Alt-D dictionary entry gtk_widget_grab_focus(widgets.entry_dict); break; case XK_f: case XK_F: if (state == GDK_CONTROL_MASK) { // Ctrl-F find text if (settings.showtexts) { gui_find_dlg(widgets.html_text, sM, FALSE, NULL); } else if (settings.showcomms) { if (settings.comm_showing) { gui_find_dlg(widgets.html_comm, sC, FALSE, NULL); } else { gui_find_dlg(widgets.html_book, sB, FALSE, NULL); } } else if (settings.showdicts) { gui_find_dlg(widgets.html_dict, sD, FALSE, NULL); } else gui_generic_warning(_("Xiphos: No windows.")); } break; case XK_g: case XK_G: if (state == GDK_MOD1_MASK) { // Alt-G genbook entry gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets.notebook_comm_book), 1); gtk_widget_grab_focus(navbar_book.lookup_entry); } break; case XK_j: if (state == 0) // J "next verse" access_on_down_eventbox_button_release_event(VERSE_BUTTON); break; case XK_k: if (state == 0) // K "previous verse" access_on_up_eventbox_button_release_event(VERSE_BUTTON); break; case XK_l: case XK_L: if (state == GDK_CONTROL_MASK) // Ctrl-L verse entry gtk_widget_grab_focus(navbar_versekey.lookup_entry); break; case XK_m: case XK_M: if (state == GDK_MOD1_MASK) // Alt-M morph { kbd_toggle_option((main_check_for_global_option(sM, "GBFMorph") || main_check_for_global_option(sM, "ThMLMorph") || main_check_for_global_option(sM, "OSISMorph")), "Morphological Tags"); } break; case XK_n: case XK_N: if (state == GDK_CONTROL_MASK) // Ctrl-N verse access_on_down_eventbox_button_release_event(VERSE_BUTTON); else if (state == 0) // n chapter access_on_down_eventbox_button_release_event(CHAPTER_BUTTON); else if (state == GDK_SHIFT_MASK) // N book access_on_down_eventbox_button_release_event(BOOK_BUTTON); else if (state == (GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_SHIFT_MASK)) { // BSP transient navigate if (biblesync_active_xmit_allowed()) { biblesync_prep_and_xmit(sM, sV); gui_set_statusbar(_("BibleSync: Current navigation sent.")); } else { gui_generic_warning(_("BibleSync: Not speaking.")); } } break; case XK_o: case XK_O: if (state == (GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_SHIFT_MASK)) on_biblesync_kbd(0); // BSP off break; case XK_p: case XK_P: if (state == GDK_CONTROL_MASK) // Ctrl-P verse access_on_up_eventbox_button_release_event(VERSE_BUTTON); else if (state == 0) // p chapter access_on_up_eventbox_button_release_event(CHAPTER_BUTTON); else if (state == GDK_SHIFT_MASK) // P book access_on_up_eventbox_button_release_event(BOOK_BUTTON); else if (state == GDK_MOD1_MASK) // Alt-P parallel detach on_undockInt_activate(NULL); else if (state == (GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_SHIFT_MASK)) on_biblesync_kbd(1); // BSP personal break; case XK_q: case XK_Q: if (state == GDK_CONTROL_MASK) // Ctrl-Q quit delete_event(NULL, NULL, NULL); break; case XK_r: case XK_R: if (state == GDK_MOD1_MASK) // Alt-R red words { kbd_toggle_option(((main_check_for_global_option(sM, "GBFRedLetterWords")) || (main_check_for_global_option(sM, "OSISRedLetterWords"))), "Words of Christ in Red"); } break; case XK_s: case XK_S: if (state == GDK_MOD1_MASK) // Alt-S strong's { kbd_toggle_option(((main_check_for_global_option(sM, "GBFStrongs")) || (main_check_for_global_option(sM, "ThMLStrongs")) || (main_check_for_global_option(sM, "OSISStrongs"))), "Strong's Numbers"); } else if (state == (GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_SHIFT_MASK)) on_biblesync_kbd(2); // BSP speaker break; case XK_t: case XK_T: if (state == GDK_CONTROL_MASK) // open a new tab on_notebook_main_new_tab_clicked(NULL, NULL); break; case XK_z: case XK_Z: if (state == GDK_MOD1_MASK) // Alt-Z open personal commentary access_to_edit_percomm(); break; case XK_plus: // Ctrl-Plus Increase base font size if (state == (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) new_base_font_size(TRUE); break; case XK_minus: // Ctrl-Minus Decrease base font size if (state == GDK_CONTROL_MASK) new_base_font_size(FALSE); break; case XK_0: // Ctrl-0 (zero) Neutralize base font size. if (state == GDK_CONTROL_MASK) { settings.base_font_size = 1; new_base_font_size(FALSE); } break; // ctrl-DIGIT [1-9] selects DIGIT-th tab. case XK_1: case XK_2: case XK_3: case XK_4: case XK_5: case XK_6: case XK_7: case XK_8: case XK_9: if (state == GDK_CONTROL_MASK) gui_select_nth_tab((event->keyval - XK_0) - 1); /* 0-based list */ case XK_F1: // F1 help if (state == 0) on_help_contents_activate(NULL, NULL); break; case XK_F2: // F2 preferences if (state == 0) on_preferences_activate(NULL, NULL); break; case XK_F3: // F3 search if (state == 0) main_open_search_dialog(); else if (state == GDK_CONTROL_MASK) gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets.notebook_sidebar), 2); break; case XK_F4: // F4 module manager if (state == 0) on_module_manager_activate(NULL, NULL); else if (state == GDK_CONTROL_MASK) gui_close_passage_tab(gtk_notebook_page_num(GTK_NOTEBOOK(widgets.notebook_main), ((PASSAGE_TAB_INFO *) cur_passage_tab)->page_widget)); break; case XK_F10: // Shift-F10 bible module right click if (state == GDK_SHIFT_MASK) gui_menu_popup(NULL, sM, NULL); /* FIXME: needs the html widget as first pram */ break; } XI_message(("on_vbox1_key_press_event\nkeycode: %d, keysym: %0x, state: %d", event->hardware_keycode, event->keyval, state)); return FALSE; }
void gui_display_about_module_dialog(gchar *modname) { const gchar *desc; gchar *about; const gchar *version, *language, *abbreviation, *size, *promo, *dist, *langtoken, *companion, *category, *feature; int feature_count = 0; GString *info = g_string_new(""); desc = main_get_mod_config_entry(modname, "Description"); about = main_get_mod_config_entry(modname, "About"); version = main_get_mod_config_entry(modname, "Version"); size = main_get_mod_config_entry(modname, "InstallSize"); promo = main_get_mod_config_entry(modname, "ShortPromo"); dist = main_get_mod_config_entry(modname, "DistributionLicense"); companion = main_get_mod_config_entry(modname, "Companion"); category = main_get_mod_config_entry(modname, "Category"); feature = main_get_mod_config_entry(modname, "Feature"); langtoken = main_get_mod_config_entry(modname, "Lang"); language = main_get_module_language(modname); abbreviation = main_get_abbreviation(modname); info = g_string_append(info, "<center><table border=\"0\" cellpadding=\"5\" cellspacing=\"0\">"); info = g_string_append(info, "<tr><td valign=\"top\">"); info = g_string_append(info, _("<b>Module name:</b> ")); info = g_string_append(info, modname); info = g_string_append(info, "<br/>"); if (abbreviation && *abbreviation) { info = g_string_append(info, _("<b>Module abbreviation:</b> ")); info = g_string_append(info, abbreviation); info = g_string_append(info, "<br/>"); } info = g_string_append(info, _("<b>Version:</b> ")); info = g_string_append(info, ((version && *version) ? version : _("No version stamp found"))); info = g_string_append(info, "<br/>"); info = g_string_append(info, _("<b>Type:</b> ")); if (feature && !strcmp(feature, "DailyDevotion")) info = g_string_append(info, _("Daily Devotion")); else if (category && !strcmp(category, "Maps")) info = g_string_append(info, _("Maps")); else if (category && !strcmp(category, "Images")) info = g_string_append(info, _("Images")); else if (category && !strcmp(category, "Glossaries")) info = g_string_append(info, _("Glossary")); else if (category && !strcmp(category, "Cults / Unorthodox / Questionable Material")) info = g_string_append(info, _("Cult")); else { switch (main_get_mod_type(modname)) { case TEXT_TYPE: info = g_string_append(info, _("Bible")); break; case COMMENTARY_TYPE: info = g_string_append(info, _("Commentary")); break; case DICTIONARY_TYPE: info = g_string_append(info, _("Dictionary")); break; case BOOK_TYPE: info = g_string_append(info, _("General Book")); break; case PERCOM_TYPE: info = g_string_append(info, _("Personal Commentary")); break; case PRAYERLIST_TYPE: info = g_string_append(info, _("Journal")); break; default: info = g_string_append(info, _("Unknown type")); break; } } info = g_string_append(info, "<br/>"); info = g_string_append(info, _("<b>Language:</b> ")); info = g_string_append(info, ((language && *language) ? language : _("Not specified"))); info = g_string_append(info, " ("); info = g_string_append(info, ((langtoken && *langtoken) ? langtoken : "?")); info = g_string_append(info, ")"); info = g_string_append(info, "<br/>"); if (size && *size) { info = g_string_append(info, _("<b>Installed size:</b> ")); info = g_string_append(info, size); info = g_string_append(info, "<br/>"); } if (companion && *companion) { info = g_string_append(info, _("<b>Companion module(s):</b></br>")); info = g_string_append(info, companion); info = g_string_append(info, "<br/>"); } info = g_string_append(info, "</td>" "<td> </td>" "<td valign=\"top\">"); info = g_string_append(info, _("<b>Features:</b>")); info = g_string_append(info, "<br/>"); if (main_check_for_global_option((gchar *)modname, "ThMLHeadings") || main_check_for_global_option((gchar *)modname, "OSISHeadings")) { info = g_string_append(info, _("* Headings")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "GBFFootnotes") || main_check_for_global_option((gchar *)modname, "ThMLFootnotes") || main_check_for_global_option((gchar *)modname, "OSISFootnotes")) { info = g_string_append(info, _("* Footnotes")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "ThMLScripref") || main_check_for_global_option((gchar *)modname, "OSISScripref")) { info = g_string_append(info, _("* Cross references")); info = g_string_append(info, "<br/>"); feature_count++; } if ((main_check_for_global_option((gchar *)modname, "GBFStrongs")) || (main_check_for_global_option((gchar *)modname, "ThMLStrongs")) || (main_check_for_global_option((gchar *)modname, "OSISStrongs"))) { info = g_string_append(info, _("* Strong's numbers")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "GBFMorph") || main_check_for_global_option((gchar *)modname, "ThMLMorph") || main_check_for_global_option((gchar *)modname, "OSISMorph")) { info = g_string_append(info, _("* Morphological tags")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "ThMLLemma") || main_check_for_global_option((gchar *)modname, "OSISLemma")) { info = g_string_append(info, _("* Lemmas")); info = g_string_append(info, "<br/>"); feature_count++; } if ((main_check_for_global_option((gchar *)modname, "GBFRedLetterWords")) || (main_check_for_global_option((gchar *)modname, "OSISRedLetterWords"))) { info = g_string_append(info, _("* Words of Christ in red")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "UTF8GreekAccents")) { info = g_string_append(info, _("* Greek accents")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "UTF8HebrewPoints")) { info = g_string_append(info, _("* Hebrew Vowel Points")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "UTF8Cantillation")) { info = g_string_append(info, _("* Hebrew Cantillation")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "ThMLVariants") || main_check_for_global_option((gchar *)modname, "OSISVariants")) { info = g_string_append(info, _("* Variant readings")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "OSISXlit")) { info = g_string_append(info, _("* Transliteration forms")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "OSISEnum")) { info = g_string_append(info, _("* Enumerations")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "OSISGlosses") || main_check_for_global_option((gchar *)modname, "OSISRuby")) { info = g_string_append(info, _("* Glosses")); info = g_string_append(info, "<br/>"); feature_count++; } if (main_check_for_global_option((gchar *)modname, "OSISMorphSegmentation")) { info = g_string_append(info, _("* Morpheme Segmentation")); info = g_string_append(info, "<br/>"); feature_count++; } if (feature_count == 0) { info = g_string_append(info, _("* <i>No features found</i>")); info = g_string_append(info, "<br/>"); } info = g_string_append(info, "</td></tr></table></center>"); if (dist && *dist) { info = g_string_append(info, "<br/><center>"); info = g_string_append(info, _("<b>Distribution license:</b>")); info = g_string_append(info, "<br/>"); info = g_string_append(info, dist); info = g_string_append(info, "</a></center>"); } if (promo) { /* if promo looks like just an undecorated url, hotlink it. */ gboolean just_url = (((strncmp(promo, "http", 4) == 0) || (strncmp(promo, "www.", 4) == 0)) && (strchr(promo, ' ') == 0)); info = g_string_append(info, "<br/><center>"); info = g_string_append(info, _("<b>Promotional:</b> ")); info = g_string_append(info, "<br/>"); if (just_url) { g_string_append(info, "<a href=\""); if (*promo == 'w') info = g_string_append(info, "http://"); info = g_string_append(info, promo); g_string_append(info, "\">"); } info = g_string_append(info, promo); if (just_url) g_string_append(info, "</a>"); info = g_string_append(info, "</center>"); } info = g_string_append(info, "<br/><hr width=\"80%%\"/><br/>"); info = g_string_append(info, about); gui_core_display_about_dialog(desc, info->str, modname); }