[sword-devel] Bible/Commentary headings

Greg Hellings greg.hellings at gmail.com
Wed Dec 1 15:48:11 MST 2010


One of the commentaries I have has a book header (in this instance it
is for 1 Peter) which is held in the module in the key "1 Peter 0:0".
Behavior concerning that introduction varies with different
applications.

1) example/cmdline/lookup 'A Commentary on I Peter' '1 Peter 0:0'
This works perfectly.
2) diatheke -b 'A Commentary on I Peter' -k 1pet.0.0
This autonormalizes to James 4:17 or something similar. 1pet.1.0
autonormalizes to James 5:22 or thereabouts.  Diatheke seems to lack a
call to AutoNormalize(0), so this behavior - while suboptimal IMHO -
is expected.  Perhaps one of the diatheke options disables
autonormalizing and turns on Headings, not sure.
3) Bibletime, opening the module to 1 Peter 1:1
This displays the heading plus the contents of the verse 1:1, and
autoscrolls the display to where the 1:1 text begins.  This is
Bibletime's expected behavior and is good.
4) Xiphos, opening the module to 1 Peter 1:1
This displays the text of 1 Peter 1:1 and is good.  I then right click
on the commentary panel and select Dispaly Book Heading.  This brings
up a blank panel.  The same with Display Chapter Heading.  I was
hashing this over on IRC before Karl had to leave and we were
comparing Bibletime and Xiphos' code.  The relevant portion of
Bibletime's code appears to be here:
http://gitorious.org/bibletime/bibletime/blobs/master/src/backend/rendering/centrydisplay.cpp#line42.
 It doesn't seem terribly different from Xiphos' code which begins
around line 114 of src/main/sword.cc in terms of how it actually uses
the engine.

Xiphos' code reads thus at that point:

        VerseKey *vkey;
        SWMgr *mgr = backend->get_mgr();

        backend->display_mod = mgr->Modules[mod_name];
        vkey = (VerseKey*)(SWKey*)(*backend->display_mod);
        vkey->Headings(1);
        vkey->AutoNormalize(0);
        vkey->Verse(0);
        vkey->Chapter(0);
        backend->display_mod->Display();

which doesn't seem to work properly.  When I change that code to this

       VerseKey *vkey;
        SWMgr *mgr = backend->get_mgr();

        backend->display_mod = mgr->Modules[mod_name];
        vkey = (VerseKey*)(SWKey*)(*backend->display_mod);
        vkey->Headings(1);
        vkey->AutoNormalize(0);
        SWBuf ll = SWBuf(vkey->getOSISBookName());
        ll += " 0:0";
        vkey->setText(ll.c_str());
        backend->display_mod->Display();

it behaves as expected.  I discovered this "workaround" when I was
working on mod2osis and just tried it on Xiphos on a whim.

What might be going wrong here when Xiphos seems to be doing what I
would understand should display the heading?

--Greg



More information about the sword-devel mailing list