Skip to content

Commit

Permalink
#1166 italic headings, plus other minor cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
karlkleinpaste committed Aug 8, 2024
1 parent a2eedd3 commit da6334b
Show file tree
Hide file tree
Showing 13 changed files with 217 additions and 148 deletions.
79 changes: 57 additions & 22 deletions src/gtk/menu_popup.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,29 @@ G_MODULE_EXPORT void on_headings_activate(GtkCheckMenuItem *menuitem,
_global_option_main_pane((GtkMenuItem *)menuitem, "Headings"); /* string not seen by user */
}

/******************************************************************************
* Name
*
*
* Synopsis
* #include "gui/menu_popup.h"
*
*
*
* Description
*
*
* Return value
*
*/

G_MODULE_EXPORT void on_italic_headings_activate(GtkCheckMenuItem *
menuitem,
gpointer user_data)
{
_global_option_main_pane((GtkMenuItem *)menuitem, "Italic Headings"); /* string not seen by user */
}

/******************************************************************************
* Name
*
Expand Down Expand Up @@ -1568,19 +1591,18 @@ G_MODULE_EXPORT void _add_and_check_global_opts(GladeXML *gxml,
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")) {
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")) {
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);
Expand All @@ -1596,17 +1618,17 @@ G_MODULE_EXPORT void _add_and_check_global_opts(GladeXML *gxml,

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")) {
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")) {
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);
Expand All @@ -1630,21 +1652,25 @@ G_MODULE_EXPORT void _add_and_check_global_opts(GladeXML *gxml,

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")) {
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, "italic_headings");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
ops->italic_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")) {
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");
Expand Down Expand Up @@ -1678,8 +1704,8 @@ G_MODULE_EXPORT void _add_and_check_global_opts(GladeXML *gxml,

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")) {
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);
Expand Down Expand Up @@ -1728,20 +1754,29 @@ G_MODULE_EXPORT void _add_and_check_global_opts(GladeXML *gxml,
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"))) ||
(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")))) {
(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);
}

item = UI_GET_ITEM(gxml, "italic_headings");

if (ops->headings) {
gtk_widget_show(item);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
ops->italic_headings);
} else {
gtk_widget_hide(item);
}

g_free(ops);
}

Expand Down
2 changes: 2 additions & 0 deletions src/gui/menu_popup.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ void on_hebrew_cantillation_activate(GtkCheckMenuItem *menuitem,
gpointer user_data);
void on_headings_activate(GtkCheckMenuItem *menuitem,
gpointer user_data);
void on_italic_headings_activate(GtkCheckMenuItem *menuitem,
gpointer user_data);
void on_transliteration_activate(GtkCheckMenuItem *menuitem,
gpointer user_data);
void on_commentary_by_chapter_activate(GtkCheckMenuItem *menuitem,
Expand Down
11 changes: 9 additions & 2 deletions src/main/display.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ A { text-decoration:none } \
*[dir=rtl] { text-align: right; } \
body { background-color:%s; color:%s; } \
.introMaterial { font-style: italic; } \
a:link{ color:%s } %s %s -->\
a:link{ color:%s } %s %s \
h3 { font-style: %s } --> \
</style>%s</head><body>"
// 6 interpolable strings: bg/txt/link colors, block, renderHeader, external css.
// 7 interpolable strings: bg/txt/link colors, block, renderHeader, italic heading, external css.

// CSS style blocks to control blocked strongs+morph output
// BOTH is when the user wants to see both types of markup.
Expand Down Expand Up @@ -976,6 +977,7 @@ GTKEntryDisp::display(SWModule &imodule)
? DOUBLE_SPACE
: ""))),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value,
Expand Down Expand Up @@ -1338,6 +1340,7 @@ GTKChapDisp::display(SWModule &imodule)
? DOUBLE_SPACE
: ""))),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value);
Expand Down Expand Up @@ -1613,6 +1616,7 @@ DialogEntryDisp::display(SWModule &imodule)
settings.link_color,
(ops->doublespace ? DOUBLE_SPACE : ""),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value,
Expand Down Expand Up @@ -1746,6 +1750,7 @@ DialogChapDisp::display(SWModule &imodule)
? DOUBLE_SPACE
: ""))),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value);
Expand Down Expand Up @@ -1947,6 +1952,7 @@ GTKPrintEntryDisp::display(SWModule &imodule)
settings.link_color,
(ops->doublespace ? DOUBLE_SPACE : ""),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value,
Expand Down Expand Up @@ -1995,6 +2001,7 @@ GTKPrintChapDisp::display(SWModule &imodule)
settings.link_color,
(ops->doublespace ? DOUBLE_SPACE : ""),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value);
Expand Down
3 changes: 3 additions & 0 deletions src/main/global_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ void main_set_global_options(GLOBAL_OPS *ops)
// always turn on headings in the engine (and later cache them).
// whether we display them or not is another matter (display.cc).
_set_global_option("Headings", 1);
_set_global_option("Italic Headings", ops->italic_headings);

_set_global_option("Words of Christ in Red", ops->words_in_red);
_set_global_option("Transliterated Forms", ops->xlit);
Expand Down Expand Up @@ -204,6 +205,8 @@ GLOBAL_OPS *main_new_globals(const gchar *mod_name)
gui_of2tf(module_options[mod_name]["Lemmas"].c_str());
ops->transliteration =
gui_of2tf(module_options[mod_name]["Transliteration"].c_str());
ops->italic_headings =
gui_of2tf(module_options[mod_name]["Italic Headings"].c_str());
ops->xlit =
gui_of2tf(module_options[mod_name]["Transliterated Forms"].c_str());
ops->enumerated =
Expand Down
1 change: 1 addition & 0 deletions src/main/global_ops.hh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct _global_ops
gboolean hebrewpoints;
gboolean hebrewcant;
gboolean headings;
gboolean italic_headings;
gboolean variants_primary;
gboolean variants_secondary;
gboolean variants_all;
Expand Down
1 change: 1 addition & 0 deletions src/main/modulecache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ConstructFlags(GLOBAL_OPS *ops)
flags |= (ops->enumerated ? Enumerated : 0);
flags |= (ops->glosses ? Glosses : 0);
flags |= (ops->morphseg ? MorphSegmentation : 0);
flags |= (ops->italic_headings ? ItalicHeadings : 0);

flags |= (ops->commentary_by_chapter ? CommentaryChapter : 0);
flags |= (ops->doublespace ? Doublespace : 0);
Expand Down
3 changes: 2 additions & 1 deletion src/main/modulecache.hh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ static const int Xlit = (1 << 16);
static const int Enumerated = (1 << 17);
static const int Glosses = (1 << 18);
static const int MorphSegmentation = (1 << 19);
// 20-23 yet to be assigned.
static const int ItalicHeadings = (1 << 20);
// 21-23 yet to be assigned.

// options known only within Xiphos.
static const int CommentaryChapter = (1 << 24);
Expand Down
Loading

0 comments on commit da6334b

Please sign in to comment.