[sword-devel] MacSword and book problems

Joachim Ansorg sword-devel@crosswire.org
Sat, 30 Nov 2002 16:35:40 +0100


I found the problem,

you have to call module->setSkipConsecutiveLinks(true) before you test for the 
books. Set it to the default value false after all tests.
So the code would look in C++ this way:

  module()->setSkipConsecutiveLinks(true);
  sword::VerseKey top, bottom;

  *module() = sword::BOTTOM;
  bottom = module()->KeyText();
  *module() = sword::TOP;
  top = module()->KeyText();

  for (int i = top.Testament(); i <= bottom.Testament(); ++i) {
    for ( int j = top.Book(); j <= bottom.Book(); ++j) {
	//get bookname here
    }
  }
  module()->setSkipConsecutiveLinks(false);

You have to write  j <= bottom.Book() to get all books including the last one 
which is availabe :)

I think the difference to the Luther commentary is that the default behaviour 
of commentaries is to jump over empty parts, but bibles need the 
setConsecutiveLinks call get that behaviour.

I hope it works for you,
Joachim

> Joachim,
>
> I looked at BibleTime, and in the end I opted for my own similar
> method, that managed to get modules such as Luther to list only
> Galations. Using ObjC, but should be pretty clear.
>
>
> VerseKey top, bottom;
> books = [[NSMutableArray alloc] init];
>
> *module = BOTTOM;
> bottom = module->KeyText();
> *module = TOP;
> top = module->KeyText();
>
> for (int i = top.Testament(); i <= bottom.Testament(); ++i)
> {
> 	for ( int j = top.Book(); j < bottom.Book(); ++j)
> 	{
> 		[books addObject:[NSString
> stringWithCString:top.books[i-1][j-1].name]];
> 	}
> }
>
>
> However this does not work for some modules such as ISV and others as
> below. I tried the BT code but had no luck.
>
> Will
>
> On Friday, November 29, 2002, at 04:01  pm, Joachim Ansorg wrote:
> > Dear Will,
> >
> > in BibleTime we managed to check whether a module contains only a new
> > testament, only an old testament or both.
> > Is this what you wanted to check or wanted you to check every book is
> > it
> > exists?
> > If you wanted to do the first I think I can give you some hints.
> >
> >
> > Joachim
> >
> >> Hi,
> >>
> >> I've been struggling for a while to get MacSword to show only the
> >> books
> >> in a module, and only have just realised, that it could (and probably
> >> is) the modules themselves. In MacSword, at least modules such as BHS
> >> and LXX think they have a NT, and modules such as ISV think it has an
> >> OT, Family thinks that it contains the whole NT, when it seems to stop
> >> after Titus. Is this a problem with my program or the modules? Any
> >> help
> >> would be appreciated.
> >>
> >> On another note a minor update to MacSword is available, ToolTips are
> >> now more refined and should function fully. Other numerous bugs are
> >> fixed as well, including proper Right to Left text rendering with
> >> verse
> >> numbers.
> >>
> >> http://www.heathmoor.plus.com/macsword/
> >>
> >> Will
> >
> > --
> > Joachim Ansorg
> > www.bibletime.de
> > www.ansorgs.de

-- 
Joachim Ansorg
www.bibletime.de
www.ansorgs.de