Skip to content

Commit

Permalink
fix #822 prefs option not to use alternating fg/bg in parallel displays.
Browse files Browse the repository at this point in the history
  • Loading branch information
karlkleinpaste committed Sep 12, 2017
1 parent 5cbf199 commit 1f3dcba
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 95 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -1,3 +1,7 @@
2017-09/11 karl <charcoal@users.sf.net>

* #822 prefs option not to use alternating fg/bg in parallel displays.

2017-09/03 karl <charcoal@users.sf.net>

* #524 fix use of fonts whose names end in digits.
Expand Down
138 changes: 74 additions & 64 deletions src/gnome2/preferences_dialog.c
Expand Up @@ -112,6 +112,7 @@ struct _preferences_check_buttons
GtkWidget *show_splash_screen;
GtkWidget *prayerlist;
GtkWidget *statusbar;
GtkWidget *alternation;

GtkWidget *show_in_viewer;
GtkWidget *show_in_dictionary;
Expand Down Expand Up @@ -1446,6 +1447,35 @@ on_checkbutton_statusbar_toggled(GtkToggleButton *togglebutton, gpointer user_da
gtk_widget_hide(widgets.appbar);
}

/******************************************************************************
* Name
* on_checkbutton_alternation_toggled
*
* Synopsis
* #include "preferences_dialog.h"
* void on_checkbutton_alternation_toggled(GtkToggleButton * togglebutton, gpointer user_data)
*
* Description
*
* Return value
* void
*/

void
on_checkbutton_alternation_toggled(GtkToggleButton *togglebutton, gpointer user_data)
{
xml_set_value("Xiphos", "misc", "alternation",
(gtk_toggle_button_get_active(togglebutton) ? "1" : "0"));
settings.alternation = gtk_toggle_button_get_active(togglebutton);

main_update_parallel_page(); /* 1 verse */
if (settings.dockedInt) { /* whole chapter */
main_update_parallel_page();
} else {
main_update_parallel_page_detached();
}
}

/******************************************************************************
* Name
* on_folder_changed
Expand Down Expand Up @@ -2170,6 +2200,8 @@ static void setup_check_buttons(void)
settings.prayerlist);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button.statusbar),
settings.statusbar);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button.alternation),
settings.alternation);

/* v-- BibleSync --v */
/* toggles */
Expand Down Expand Up @@ -2245,6 +2277,9 @@ static void setup_check_buttons(void)
g_signal_connect(check_button.statusbar, "toggled",
G_CALLBACK(on_checkbutton_statusbar_toggled),
NULL);
g_signal_connect(check_button.alternation, "toggled",
G_CALLBACK(on_checkbutton_alternation_toggled),
NULL);

/* v-- BibleSync --v */
g_signal_connect(check_button.bs_debug, "toggled",
Expand Down Expand Up @@ -2895,82 +2930,57 @@ static void create_preferences_dialog(void)
/* color pickers */
color_picker.text_background = UI_GET_ITEM(gxml, "colorbutton1");
color_picker.text = UI_GET_ITEM(gxml, "colorbutton2");
color_picker.text_current_verse =
UI_GET_ITEM(gxml, "colorbutton3");
color_picker.text_current_verse = UI_GET_ITEM(gxml, "colorbutton3");
color_picker.verse_numbers = UI_GET_ITEM(gxml, "colorbutton4");
color_picker.href_links = UI_GET_ITEM(gxml, "colorbutton5");
color_picker.highlight_fg = UI_GET_ITEM(gxml, "colorbutton6");
color_picker.highlight_bg = UI_GET_ITEM(gxml, "colorbutton7");
color_picker.href_links = UI_GET_ITEM(gxml, "colorbutton5");
color_picker.highlight_fg = UI_GET_ITEM(gxml, "colorbutton6");
color_picker.highlight_bg = UI_GET_ITEM(gxml, "colorbutton7");

color_picker.invert_normal = UI_GET_ITEM(gxml, "invert_normal");
color_picker.invert_highlight =
UI_GET_ITEM(gxml, "invert_highlight");

check_button.use_linked_tabs = UI_GET_ITEM(gxml, "checkbutton10");
check_button.readaloud = UI_GET_ITEM(gxml, "checkbutton11");
check_button.show_verse_num = UI_GET_ITEM(gxml, "checkbutton12");
check_button.use_default_dictionary =
UI_GET_ITEM(gxml, "checkbutton6");
check_button.show_devotion = UI_GET_ITEM(gxml, "checkbutton7");
check_button.show_splash_screen =
UI_GET_ITEM(gxml, "checkbutton8");
check_button.use_chapter_scroll =
UI_GET_ITEM(gxml, "checkbutton_scroll");

check_button.use_imageresize =
UI_GET_ITEM(gxml, "checkbutton_imageresize");
check_button.use_linked_tabs = UI_GET_ITEM(gxml, "checkbutton10");
check_button.readaloud = UI_GET_ITEM(gxml, "checkbutton11");
check_button.show_verse_num = UI_GET_ITEM(gxml, "checkbutton12");
check_button.use_default_dictionary = UI_GET_ITEM(gxml, "checkbutton6");
check_button.show_devotion = UI_GET_ITEM(gxml, "checkbutton7");
check_button.show_splash_screen = UI_GET_ITEM(gxml, "checkbutton8");
check_button.use_chapter_scroll = UI_GET_ITEM(gxml, "checkbutton_scroll");

check_button.use_imageresize = UI_GET_ITEM(gxml, "checkbutton_imageresize");
#ifdef WIN32
/* webkit image hackery requires resize always be enabled. */
gtk_widget_hide(check_button.use_imageresize);
#endif
check_button.use_verse_num_bold =
UI_GET_ITEM(gxml, "checkbutton_verse_num_bold");
check_button.use_verse_num_bracket =
UI_GET_ITEM(gxml, "checkbutton_verse_num_bracket");
check_button.use_verse_num_superscript =
UI_GET_ITEM(gxml, "checkbutton_verse_num_superscript");
check_button.versehighlight =
UI_GET_ITEM(gxml, "checkbutton_versehighlight");
check_button.annotate_highlight =
UI_GET_ITEM(gxml, "checkbutton_annotate_highlight");
check_button.xrefs_in_verse_list =
UI_GET_ITEM(gxml, "checkbutton_xrefs_in_verse_list");
check_button.prayerlist =
UI_GET_ITEM(gxml, "checkbutton_prayerlist");
check_button.statusbar = UI_GET_ITEM(gxml, "checkbutton_statusbar");
check_button.use_verse_num_bold = UI_GET_ITEM(gxml, "checkbutton_verse_num_bold");
check_button.use_verse_num_bracket = UI_GET_ITEM(gxml, "checkbutton_verse_num_bracket");
check_button.use_verse_num_superscript = UI_GET_ITEM(gxml, "checkbutton_verse_num_superscript");
check_button.versehighlight = UI_GET_ITEM(gxml, "checkbutton_versehighlight");
check_button.annotate_highlight = UI_GET_ITEM(gxml, "checkbutton_annotate_highlight");
check_button.xrefs_in_verse_list = UI_GET_ITEM(gxml, "checkbutton_xrefs_in_verse_list");
check_button.prayerlist = UI_GET_ITEM(gxml, "checkbutton_prayerlist");
check_button.statusbar = UI_GET_ITEM(gxml, "checkbutton_statusbar");
check_button.alternation = UI_GET_ITEM(gxml, "checkbutton_alternation");

/* v-- BibleSync --v */
check_button.bs_debug =
UI_GET_ITEM(gxml, "checkbutton_BSP_nav_debug");
check_button.bs_presence =
UI_GET_ITEM(gxml, "checkbutton_BSP_presence");
check_button.bs_mismatch =
UI_GET_ITEM(gxml, "checkbutton_BSP_mismatch");
check_button.bs_group_tab =
UI_GET_ITEM(gxml, "checkbutton_BSP_group_tab");
check_button.bs_privacy =
UI_GET_ITEM(gxml, "checkbutton_BSP_privacy");

radio_button.bs_mode_off =
UI_GET_ITEM(gxml, "radiobutton_BSP_off");
radio_button.bs_mode_personal =
UI_GET_ITEM(gxml, "radiobutton_BSP_personal");
radio_button.bs_mode_speaker =
UI_GET_ITEM(gxml, "radiobutton_BSP_speaker");
radio_button.bs_mode_audience =
UI_GET_ITEM(gxml, "radiobutton_BSP_audience");

radio_button.bs_nav_direct =
UI_GET_ITEM(gxml, "radiobutton_BSP_nav_direct");
radio_button.bs_nav_verselist =
UI_GET_ITEM(gxml, "radiobutton_BSP_nav_verselist");

radio_button.bs_listen_some =
UI_GET_ITEM(gxml, "radiobutton_BSP_listen_some");
radio_button.bs_listen_all =
UI_GET_ITEM(gxml, "radiobutton_BSP_listen_all");
radio_button.bs_listen_none =
UI_GET_ITEM(gxml, "radiobutton_BSP_listen_none");
check_button.bs_debug = UI_GET_ITEM(gxml, "checkbutton_BSP_nav_debug");
check_button.bs_presence = UI_GET_ITEM(gxml, "checkbutton_BSP_presence");
check_button.bs_mismatch = UI_GET_ITEM(gxml, "checkbutton_BSP_mismatch");
check_button.bs_group_tab = UI_GET_ITEM(gxml, "checkbutton_BSP_group_tab");
check_button.bs_privacy = UI_GET_ITEM(gxml, "checkbutton_BSP_privacy");

radio_button.bs_mode_off = UI_GET_ITEM(gxml, "radiobutton_BSP_off");
radio_button.bs_mode_personal = UI_GET_ITEM(gxml, "radiobutton_BSP_personal");
radio_button.bs_mode_speaker = UI_GET_ITEM(gxml, "radiobutton_BSP_speaker");
radio_button.bs_mode_audience = UI_GET_ITEM(gxml, "radiobutton_BSP_audience");

radio_button.bs_nav_direct = UI_GET_ITEM(gxml, "radiobutton_BSP_nav_direct");
radio_button.bs_nav_verselist = UI_GET_ITEM(gxml, "radiobutton_BSP_nav_verselist");

radio_button.bs_listen_some = UI_GET_ITEM(gxml, "radiobutton_BSP_listen_some");
radio_button.bs_listen_all = UI_GET_ITEM(gxml, "radiobutton_BSP_listen_all");
radio_button.bs_listen_none = UI_GET_ITEM(gxml, "radiobutton_BSP_listen_none");

speaker_window = UI_GET_ITEM(gxml, "speakerwindow");
biblesync_update_speaker();
Expand Down
35 changes: 13 additions & 22 deletions src/gui/preferences_dialog.h
Expand Up @@ -121,37 +121,28 @@ void on_checkbutton11_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton12_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton_verse_num_bold_toggled(GtkToggleButton *
togglebutton,
void on_checkbutton_verse_num_bold_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton_verse_num_bracket_toggled(GtkToggleButton *
togglebutton,
void on_checkbutton_verse_num_bracket_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton_verse_num_superscript_toggled(GtkToggleButton *
togglebutton,
gpointer
user_data);
void on_checkbutton_verse_num_superscript_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton_scroll_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton_imageresize_toggled(GtkToggleButton *
togglebutton,
void on_checkbutton_imageresize_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton_versehighlight_toggled(GtkToggleButton *
togglebutton,
void on_checkbutton_versehighlight_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton_annotate_highlight_toggled(GtkToggleButton *
togglebutton,
void on_checkbutton_annotate_highlight_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton_xrefs_in_verse_list_toggled(GtkToggleButton *
togglebutton,
gpointer
user_data);
void on_checkbutton_prayerlist_toggled(GtkToggleButton *
togglebutton,
void on_checkbutton_xrefs_in_verse_list_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton_prayerlist_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton_statusbar_toggled(GtkToggleButton *
togglebutton,
void on_checkbutton_statusbar_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_checkbutton_alternation_toggled(GtkToggleButton *togglebutton,
gpointer user_data);
void on_basecombobox1_changed(GtkComboBox *combobox,
gpointer user_data);

Expand Down
7 changes: 4 additions & 3 deletions src/main/parallel_view.cc
Expand Up @@ -683,7 +683,8 @@ void main_update_parallel_page(void)

is_rtol = main_is_mod_rtol(mod_name);

if (modidx % 2 == 1) { /* alternating background color */
/* alternating background color */
if (settings.alternation && (modidx % 2 == 1)) {
rowcolor = settings.bible_text_color;
textcolor = settings.bible_bg_color;
} else {
Expand Down Expand Up @@ -869,7 +870,7 @@ static void interpolate_parallel_display(SWBuf &text, gchar *key, gint parallel_
text += "<tr valign=\"top\">";

// alternate background colors.
bgColor = (verse % 2 == 0)
bgColor = (settings.alternation && (verse % 2 == 0))
? settings.bible_text_color
: settings.bible_bg_color;

Expand All @@ -886,7 +887,7 @@ static void interpolate_parallel_display(SWBuf &text, gchar *key, gint parallel_
if ((verse == cur_verse) && is_bible_text[modidx])
textColor = settings.currentverse_color;
else
textColor = (verse % 2 == 0)
textColor = (settings.alternation && (verse % 2 == 0))
? settings.bible_bg_color
: settings.bible_text_color;

Expand Down
7 changes: 7 additions & 0 deletions src/main/settings.c
Expand Up @@ -1111,6 +1111,13 @@ void load_settings_structure(void)
settings.statusbar = 1;
}

if ((buf = xml_get_value("misc", "alternation"))) {
settings.alternation = atoi(buf);
} else {
xml_add_new_item_to_section("misc", "alternation", "1");
settings.alternation = 1;
}

#if 1
settings.browsing = 1; /* unconditional - no longer toggle-able. */
#else
Expand Down
3 changes: 3 additions & 0 deletions src/main/settings.h
Expand Up @@ -208,6 +208,9 @@ struct _settings
/* statusbar setting */
int statusbar;

/* parallel color alternation */
int alternation;

/* if true parallel tab is showing */
int paratab_showing;

Expand Down
24 changes: 22 additions & 2 deletions ui/prefs.glade
Expand Up @@ -1501,7 +1501,7 @@
<property name="active">True</property>
<property name="draw_indicator">True</property>
<accessibility>
<atkproperty name="AtkObject::accessible-name" translatable="yes">Enable Prayer Lists Checkbox</atkproperty>
<atkproperty name="AtkObject::accessible-name" translatable="yes">Enable Statusbar Checkbox</atkproperty>
</accessibility>
</widget>
<packing>
Expand All @@ -1510,6 +1510,26 @@
<property name="position">10</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="checkbutton_alternation">
<property name="label" translatable="yes">Parallel color alternation</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip" translatable="yes">Parallel window can use alternating foreground/background.</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<accessibility>
<atkproperty name="AtkObject::accessible-name" translatable="yes">Enable Parallel Alternation Checkbox</atkproperty>
</accessibility>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">11</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
Expand Down Expand Up @@ -1601,7 +1621,7 @@
</child>
</widget>
<packing>
<property name="position">11</property>
<property name="position">12</property>
</packing>
</child>
<child>
Expand Down
27 changes: 25 additions & 2 deletions ui/prefs.gtkbuilder
Expand Up @@ -1786,7 +1786,7 @@
<property name="draw_indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="checkbutton_statusbar-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Enable Prayer Lists Checkbox</property>
<property name="AtkObject::accessible-name" translatable="yes">Enable Statusbar Checkbox</property>
</object>
</child>
</object>
Expand All @@ -1796,6 +1796,29 @@
<property name="position">10</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton_alternation">
<property name="label" translatable="yes">Parallel color alternation</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Parallel window can use alternating foreground/background.</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="checkbutton_alternation-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Enable Parallel Alternation Checkbox</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">11</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hbox3">
<property name="visible">True</property>
Expand Down Expand Up @@ -1903,7 +1926,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">11</property>
<property name="position">12</property>
</packing>
</child>
<child>
Expand Down

0 comments on commit 1f3dcba

Please sign in to comment.