[sword-devel] Temporarily suspend option filters
Troy A. Griffitts
scribe at crosswire.org
Sun Feb 1 15:01:33 MST 2009
David and Greg,
RenderText can take a buffer to render rather than the current key.
This is useful for when you grab EntryAttributes from a module and want
to process them through the same filters for that module. But this
won't help turn certain filters on or off temporarily.
It might be interesting to add a return value to the option setter to
return the current value of the option so you could make 2 less calls,
but typically, you just make sure the options are off, get your text,
then turn them back to what they were.
SWBuf fn = mgr.getGlobalOption("Footnotes");
SWBuf xf = mgr.getGlobalOption("Cross-references");
mgr.setGlobalOption("Footnotes", "Off");
mgr.setGlobalOption("Cross-references", "Off");
SWBuf text = module.RenderText();
mgr.setGlobalOption("Footnotes", fn);
mgr.setGlobalOption("Cross-references", xf);
We could add a flag to RenderText to render with default values for all
filters, I suppose. This wouldn't give complete control over what
options one wanted on or off or whatever other values they should be
("Secondary Reading", etc.), but might do what we want 80% of the time.
Another _option_ :) (what we do for searching and other such things) is
to have a second SWMgr for a specific purpose (e.g. popup rendering)
with filter options set accordingly. SWMgr instances shouldn't be very
expensive as our FileMgr is always fully utilized with even just a few
modules loaded, so the pooled file handlers are already peaked so you
won't have any more open files.
But basically, in summery, for now, just turn them off temporarily if
you want them off temporarily :)
-Troy.
Gregory Hellings wrote:
> I believe the renderText can have a filter passed explicitly to do that.
> I might have the wrong method name, but there is something like that.
> Basically you'd create a separate filter object and send the text
> through that.
>
> Greg
>
>
>
> On Feb 1, 2009, at 11:31, David Trotz <dtrotzjr at crosswire.org> wrote:
>
>> Is there a quick and easy way yo temporarily suspend option filters
>> (strongs, footnotes, etc.) for a given module? I have added pop-ups to
>> the commentaries in SwordReader and having it display strongs numbers
>> (because they are turned on globally) is not useful nor helpful and is
>> confusing. Due to the limited screen space I really would like to be
>> able to turn these off temporarily then restore them once I have the
>> pop-up rendered.
>> --
>> David Trotz
>>
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
More information about the sword-devel
mailing list