[sword-devel] HTMHREF footnote URL to footnote text

Barry Drake b.drake at ntlworld.com
Wed Nov 28 01:35:34 MST 2007


Hi there ........

Troy A. Griffitts wrote:
> you should be able to use the URL class provided in 
> utilfuns/url.cpp to extract the values you need for the lookup, then you 
> can use those to grab the footnote text to display.   
Robin .......  first quick look at the URL Clicked handler in 
SimpleNavigator.cpp nearly works - BUT fails when the Sword engine needs 
to get a second handle on a module file.  I suspect that Windows Mobile 
simply doesn't allow multiple instances of a handle to the same file.  
Next step will be to write a very simple file handling program for 
Windows Mobile to try and open two instances of a text file in order to 
test this out.  If I am right about this, non-handling of URL references 
might be a permanent 'feature' of SwordReader!

This is the code snippet based on Troy's suggestion - I've commented 
what happens:

SWMgr swmanager;
URL footnote(t);  // t is char* containing URL string
SWBuf module = footnote.getParameterValue("module");
SWBuf key = footnote.getParameterValue("passage");
SWBuf footnoteNumber = footnote.getParameterValue("value");
// Now that you have extracted all the info you need from the URL,
// you can lookup the footnote...
// get the module it's in
SWModule *mod = swmanager.getModule(module);
// set that module to the correct entry
mod->setKey(key.c_str());

// OK so far
MessageBox(0, strtowstr(t), L"This is 't' - OK?", MB_OK); // We get here OK
// force a parse of the entry
mod->RenderText();

// Not OK any longer ...........
// the problens seem to be -  fails to open/re-open module files in 
above line: the error message (MessageBox) is:
// Unable to open: File\Storage Card\modules\texts\ztext\kjv\ot.bzv 
error: 5 
// the file path/name is correct .........
// this is repeated so 'something' tries twice to open the same file.
// the MessageBox seems to be generated by the Windows Mobile System .......
// then we reach the next line after closing the two error MessageBox 
(...(es))
MessageBox(0, strtowstr(t), L"This is 't' again - a bit further on", 
MB_OK);



More information about the sword-devel mailing list