Skip to content

Commit

Permalink
fix #725 add book/chapter journal template to provide for personal re…
Browse files Browse the repository at this point in the history
…ad-through tracking.
  • Loading branch information
karlkleinpaste committed Sep 4, 2017
1 parent 01f31cd commit ec2e709
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -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 <charcoal@users.sf.net>

Expand Down
1 change: 1 addition & 0 deletions help/C/interface.xml
Expand Up @@ -759,6 +759,7 @@
<itemizedlist>
<listitem>
<para><guibutton>Ctrl-p/Ctrl-n</guibutton>: Verse previous/next. Also <guibutton>k/j</guibutton>.</para>
As well, text of the verses before and after the current chapter can be clicked to navigate across chapters.
</listitem>
<listitem>
<para><guibutton>p/n</guibutton>: Chapter previous/next.</para>
Expand Down
6 changes: 4 additions & 2 deletions help/C/journals.xml
Expand Up @@ -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.
</para>

Expand Down Expand Up @@ -54,9 +54,11 @@
per-month structure in which to track needed content.
<guimenuitem>Daily Journal</guimenuitem> is a full
365-day calendar in which to track a personal journal
or ongoing prayer needs. And finally,
or ongoing prayer needs.
<guimenuitem>Outlined Topic</guimenuitem> is a full,
expandable outline suitable for topics and subtopics.
<guimenuitem>Book/Chapter</guimenuitem> is a book and
chapter outline from Genesis through Revelation.
</para>

<para>
Expand Down
6 changes: 6 additions & 0 deletions src/gnome2/sidebar.c
Expand Up @@ -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;
Expand Down
64 changes: 64 additions & 0 deletions src/main/prayerlists.cc
Expand Up @@ -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;
Expand Down Expand Up @@ -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<br/>", i);
content += (SWBuf)buf;
}
setEntryText(book, content.c_str());
}
}

delete treeKey;
return TRUE;
}
1 change: 1 addition & 0 deletions src/main/prayerlists.h
Expand Up @@ -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
}
Expand Down
12 changes: 12 additions & 0 deletions ui/xi-menus-popup.gtkbuilder
Expand Up @@ -849,6 +849,18 @@
<signal name="activate" handler="on_outlined_topic_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="create_book_chapter_list">
<property name="label" translatable="yes">Book/Chapter</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Create a new book/chapter outline</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_book_chapter_activate" swapped="no"/>
</object>
</child>
</object>
<object class="GtkMenu" id="menu_prayerlist_mod">
<property name="can_focus">False</property>
Expand Down
12 changes: 12 additions & 0 deletions ui/xi-menus-popup_old.gtkbuilder
Expand Up @@ -857,6 +857,18 @@
<signal name="activate" handler="on_outlined_topic_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="create_book_chapter_list">
<property name="label" translatable="yes">Book/Chapter</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Create a new book/chapter outline</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_book_chapter_activate" swapped="no"/>
</object>
</child>
</object>
<object class="GtkMenu" id="menu_prayerlist_mod">
<property name="can_focus">False</property>
Expand Down
24 changes: 24 additions & 0 deletions ui/xi-menus.glade
Expand Up @@ -1971,6 +1971,30 @@
</widget>
</child>

<child>
<widget class="GtkImageMenuItem" id="create_book_chapter_list">
<property name="visible">True</property>
<property name="tooltip"
translatable="yes">Create a new book/chapter outline</property>
<property name="label" translatable="yes">Book/Chapter</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_book_chapter_activate"
last_modification_time="Tue, 07 Apr 2009 23:29:59 GMT"/>

<child internal-child="image">
<widget class="GtkImage" id="image1469">
<property name="visible">True</property>
<property name="stock">gtk-edit</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>

</widget>

<widget class="GtkMenu" id="menu_prayerlist_mod">
Expand Down

0 comments on commit ec2e709

Please sign in to comment.