From ec2e7092ca2f3e4911c41feccad8a8e93a162ad9 Mon Sep 17 00:00:00 2001 From: Karl Kleinpaste Date: Mon, 4 Sep 2017 10:34:10 -0400 Subject: [PATCH] fix #725 add book/chapter journal template to provide for personal read-through tracking. --- ChangeLog | 1 + help/C/interface.xml | 1 + help/C/journals.xml | 6 ++- src/gnome2/sidebar.c | 6 +++ src/main/prayerlists.cc | 64 ++++++++++++++++++++++++++++++++ src/main/prayerlists.h | 1 + ui/xi-menus-popup.gtkbuilder | 12 ++++++ ui/xi-menus-popup_old.gtkbuilder | 12 ++++++ ui/xi-menus.glade | 24 ++++++++++++ 9 files changed, 125 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a4a47aaf..a18a56dd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ (ex. Goudy Bookletter 1911.) * #788 use saved status of detached sidebar. * #739 click verse text before/after to cross chapters. + * #725 offer book/chapter-outlined journal. 2017-08-23 karl diff --git a/help/C/interface.xml b/help/C/interface.xml index cd03f399a..a774e3282 100644 --- a/help/C/interface.xml +++ b/help/C/interface.xml @@ -759,6 +759,7 @@ Ctrl-p/Ctrl-n: Verse previous/next. Also k/j. + As well, text of the verses before and after the current chapter can be clicked to navigate across chapters. p/n: Chapter previous/next. diff --git a/help/C/journals.xml b/help/C/journals.xml index 8607303a1..ca10badef 100644 --- a/help/C/journals.xml +++ b/help/C/journals.xml @@ -25,7 +25,7 @@ Right-click on this entry, and you will be offered a context menu to create new modules. All the offered options are of the same type, but what is offered is a - variety of templates from which to work. There are 5 + variety of templates from which to work. There are 6 templates at this time. @@ -54,9 +54,11 @@ per-month structure in which to track needed content. Daily Journal is a full 365-day calendar in which to track a personal journal - or ongoing prayer needs. And finally, + or ongoing prayer needs. Outlined Topic is a full, expandable outline suitable for topics and subtopics. + Book/Chapter is a book and + chapter outline from Genesis through Revelation. diff --git a/src/gnome2/sidebar.c b/src/gnome2/sidebar.c index 11b87c818..2b7828457 100644 --- a/src/gnome2/sidebar.c +++ b/src/gnome2/sidebar.c @@ -1146,6 +1146,12 @@ on_outlined_topic_activate(GtkMenuItem *menuitem, gpointer user_data) main_prayerlist_outlined_topic_create(); } +G_MODULE_EXPORT void +on_book_chapter_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + main_prayerlist_book_chapter_create(); +} + GtkWidget *create_menu_prayerlist(void) { GtkWidget *menu; diff --git a/src/main/prayerlists.cc b/src/main/prayerlists.cc index cf15235e4..04d3799a5 100644 --- a/src/main/prayerlists.cc +++ b/src/main/prayerlists.cc @@ -49,6 +49,11 @@ #include "gui/debug_glib_null.h" +// sword stuff for canonical book names + chapter counts +// to construct prototype all-chapters outline. (#725) +#include "sword/versificationmgr.h" +#include "sword/canon.h" + #ifndef NO_SWORD_NAMESPACE using sword::TreeKeyIdx; using sword::RawGenBook; @@ -525,3 +530,62 @@ main_prayerlist_outlined_topic_create(void) delete treeKey; return TRUE; } + +/****************************************************************************** + * Name + * main_prayerlist_book_chapter_create + * + * Synopsis + * #include "main/prayer_list.h" + * gint main_prayerlist_book_chapter_create(void) + * + * Description + * create a per-chapter outline for the entire bible + * + * Return value + * gboolean + */ + +gboolean +main_prayerlist_book_chapter_create(void) +{ + char *listname = prayerlist_fundamentals(_("A journal sectioned by Bible book and chapter. \\par\\par Module created by Xiphos."), + _("BibleChapter")); + if (listname == NULL) + return FALSE; + + gchar *path = g_strdup_printf("%s/" DOTSWORD "/modules/genbook/rawgenbook/%s/%s", + settings.homedir, listname, listname); + + g_free(listname); + RawGenBook::createModule(path); + RawGenBook *book = new RawGenBook(path); + + TreeKeyIdx root = *((TreeKeyIdx *)((SWKey *)(*book))); + TreeKeyIdx *treeKey = (TreeKeyIdx *)(SWKey *)(*book); + + struct sbook *sbook; + struct sbook *otnt[2] = { sword::otbooks, sword::ntbooks }; + gboolean first = TRUE; + + for (int idx = 0; idx < 2; idx++) { + for (sbook = otnt[idx]; sbook->chapmax != 0; ++sbook) { + if (first) { + appendChild(treeKey, sbook->name); + first = FALSE; + } else + appendSibling(treeKey, sbook->name); + + SWBuf content = ""; + char buf[10]; + for (int i = 1; i <= sbook->chapmax; ++i) { + sprintf(buf, "%d\t
", i); + content += (SWBuf)buf; + } + setEntryText(book, content.c_str()); + } + } + + delete treeKey; + return TRUE; +} diff --git a/src/main/prayerlists.h b/src/main/prayerlists.h index 1901001df..326fa3501 100644 --- a/src/main/prayerlists.h +++ b/src/main/prayerlists.h @@ -31,6 +31,7 @@ gboolean main_prayerlist_subject_create(void); gboolean main_prayerlist_monthly_create(void); gboolean main_prayerlist_journal_create(void); gboolean main_prayerlist_outlined_topic_create(void); +gboolean main_prayerlist_book_chapter_create(void); #ifdef __cplusplus } diff --git a/ui/xi-menus-popup.gtkbuilder b/ui/xi-menus-popup.gtkbuilder index 0e927de93..6e31cb1bb 100644 --- a/ui/xi-menus-popup.gtkbuilder +++ b/ui/xi-menus-popup.gtkbuilder @@ -849,6 +849,18 @@ + + + Book/Chapter + False + True + False + Create a new book/chapter outline + True + True + + + False diff --git a/ui/xi-menus-popup_old.gtkbuilder b/ui/xi-menus-popup_old.gtkbuilder index 191061863..2eba91a1d 100644 --- a/ui/xi-menus-popup_old.gtkbuilder +++ b/ui/xi-menus-popup_old.gtkbuilder @@ -857,6 +857,18 @@ + + + Book/Chapter + True + False + Create a new book/chapter outline + False + True + True + + + False diff --git a/ui/xi-menus.glade b/ui/xi-menus.glade index eb5dcd2a8..9627e9d3d 100644 --- a/ui/xi-menus.glade +++ b/ui/xi-menus.glade @@ -1971,6 +1971,30 @@ + + + True + Create a new book/chapter outline + Book/Chapter + True + + + + + True + gtk-edit + 4 + 0.5 + 0.5 + 0 + 0 + + + + +