On Thu, Mar 25, 2010 at 05:28:04PM +0100, Johannes Hofmann wrote:
On Thu, Mar 25, 2010 at 03:56:31PM +0000, corvid wrote:
Johannes wrote:
On Wed, Mar 24, 2010 at 04:49:09PM +0000, corvid wrote:
Johannes wrote:
On Wed, Mar 24, 2010 at 02:34:13PM +0530, Rajesh Marathe wrote:
Hello Corvid,
You hit the nail on its head. I will definitely use iterators to iterate on the words on a page. I do have the code with me which is based on findtext.cc as mentioned by Johannes. But, using iterators I can move to a word on a page. But to get its style, I still need to access the "x_link" variable which is in the class Textblock. Therefore, my understanding was to use both iterator class and the Textblock class as well.
However, after seeing your email I get a feeling that my understanding might be incorrect. So, right now, my problem is not in using iterators (Which I intend to do anyways) but getting the x_link variable which is in Textblock class. Please let me know where am I wrong.
Ah, I think I see your problem now. Iterators have the getContent() method, but Content does not include the style and therefore not the x_link. I'd say we should enhance the Iterator interface to make it possible to get the style somehow. However I don't know yet what would be the best way to do it. corvid, what do you think?
Ah, in my earlier mail, I was imagining there being a getFocusable() in our new iterator that gave back a Widget and a linkNo in the same way that the char iterator has getChar(), but now I see that the base iterator already has a getWidget(), so I guess we would just need a getLinkNo().
Right, either that, or a bit more general a getStyle() method, that would return the style at the current position (including x_link).
Maybe. I don't think I have a strong opinion on 'general' vs. 'unnecessary exposure' on this issue yet.
Good point. Let's start with getLinkNo() and switch to getStyle() once we actually need another style member.
Ok, I made a very rough patch to demonstrate the concept (see attachment). The main problem - apart from code style - is how to restore the original color of the link once anotherone has been selected. This is not working properly with this patch, but it's a start. You can switch from one link to the next with <Tab>. Cheers, Johannes