[bt-devel] Cross-reference question

Ben cricketc at gmail.com
Sun Jun 10 18:47:29 MST 2012


Hello all,

I have a little wish for BibleTime that I've been trying to implement, 
but I'm running into some problems (and I'm not at all an expert in 
C++). I thought I'd see if anyone had some insights to help.

My problem/wish is that when I open BibleTime on a computer where 
there's no default Bible defined, and I mouse-over a cross-reference, 
nothing shows up in the Mag. I would like to change that so that if 
there's no default Bible, it uses the current Bible being displayed to 
show the cross-referenced verses.

I've found CInfoDisplay::decodeCrossReference, and I see that in this 
case, the "module" variable doesn't get initialized, so it can't pull 
any verse data to be displayed.

As I test, I'm using the ESV module, and I would like to get 
cross-referenced verses displayed in ESV, so I've been trying to get the 
current module being used in CInfoDisplay. I'm not sure if this is the 
best or correct way to get the current module, but here's what I tried 
in CInfoDisplay::decodeCrossReference:

CDisplayWindow* window = m_htmlPart->parentWindow();
CSwordKey* key = window->key();
CSwordModuleInfo curMod(*(key->module()));
if (!module) {
	module = &curMod;
}

I was able to compile the code, but got a seg fault when I ran it.

I also tried just getting the name of the current module, and this 
seg-faulted as well:
std::cout << 
m_htmlPart->parentWindow()->key()->module()->name().toStdString();

Is this the correct way to get the current module being viewed from 
CInfoDisplay? Is there a better way? Any hints or tips?

Thanks,
-Ben



More information about the bt-devel mailing list