Problem using "Textblock" Class.
Hi, I am trying to implement the support for using the tab or other keyboard keys to set focus on web page links. As part of this, I started out with adding a new Class and would like to use some sort of iterator in this class. I would also like to use the 'Textblock' object to retrieve the style->x_link for a word. However, when I try to initialize the Textblock object in my new class, I get a linker error. The details are as under: The basic skeletal code for new class is: ======================================== findlinks.cc namespace dw { namespace core { FindLinks::FindLinks () { widget = NULL; iterator = NULL; } FindLinks::~FindLinks () { if (iterator) delete iterator; } void FindLinks::getlink (void) { MSG("\n Hi !! I came to findlinks"); Textblock *textblock = new Textblock (false); } I have included "dw/textblock.hh" in the above file and also included core.hh. Compilation goes through but I end up with a linker error as under: ===================================================================== ../dw/libDw-core.a(findlinks.o): In function `dw::core::FindLinks::getlink()': /home/rmarathe/dillo-2.2/dw/findlinks.cc:25: undefined reference to `dw::Textblock::Textblock(bool)' collect2: ld returned 1 exit status I believe that I still need to use "iterator" and the Textblock" classes to implement this feature. Am I using the Textblock in a right way or am I missing something in the above code ? Please do let me know, regards, Rajesh Marathe.
Hi, On Fri, Mar 19, 2010 at 10:26:25AM +0530, Rajesh Marathe wrote:
Hi,
I am trying to implement the support for using the tab or other keyboard keys to set focus on web page links. As part of this, I started out with adding a new Class and would like to use some sort of iterator in this class. I would also like to use the 'Textblock' object to retrieve the style->x_link for a word. However, when I try to initialize the Textblock object in my new class, I get a linker error. The details are as under:
The basic skeletal code for new class is: ======================================== findlinks.cc
namespace dw { namespace core {
FindLinks::FindLinks () { widget = NULL; iterator = NULL;
}
FindLinks::~FindLinks () { if (iterator) delete iterator; }
void FindLinks::getlink (void) { MSG("\n Hi !! I came to findlinks"); Textblock *textblock = new Textblock (false);
}
I have included "dw/textblock.hh" in the above file and also included core.hh.
I guess it's because Textblock is in the dw namespace, not dw::core, so removing "namespace core {" in the above example should fix it. Alternatively you could use "new dw::Textblock (false);".
Compilation goes through but I end up with a linker error as under: ===================================================================== ../dw/libDw-core.a(findlinks.o): In function `dw::core::FindLinks::getlink()': /home/rmarathe/dillo-2.2/dw/findlinks.cc:25: undefined reference to `dw::Textblock::Textblock(bool)' collect2: ld returned 1 exit status
I believe that I still need to use "iterator" and the Textblock" classes to implement this feature. Am I using the Textblock in a right way or am I missing something in the above code ? Please do let me know,
Hm, I can't really tell from the code above. I would expect some code that uses the existing iterator mechanism to walk through a page and find links and buttons, and so on. Maybe you could use findtext.cc as an example. Regards, Johannes PS: The keyboard navigation feature would be highly appreciated!
Hello Johannes, To make things simple, I added a method in the file findtext.cc which is as under: The purpose of this method is to access "Textblock" from the file findtext.cc. ----------------------------------------------------------------------------------------------- /* RMP */ void FindtextState::getLink (void) { MSG("\n RMP: getLink function"); Textblock *textblock = new dw::Textblock (false); textblock->getNextLink (); } /* RMP */ ----------------------------------------------------------------------------------------------- I have included "textblock.hh" in the file 'findtext.cc'. I still get an error like shown below: ============================================================ ../dw/libDw-core.a(findtext.o): In function `dw::core::FindtextState::getLink()': /home/rmarathe/dillo-2.2/dw/findtext.cc:299: undefined reference to `dw::Textblock::Textblock(bool)' /home/rmarathe/dillo-2.2/dw/findtext.cc:301: undefined reference to `dw::Textblock::getNextLink()' collect2: ld returned 1 exit status make[2]: *** [dw-imgbuf-mem-test] Error 1 make[2]: Leaving directory `/home/rmarathe/dillo-2.2/test' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/rmarathe/dillo-2.2' make: *** [all] Error 2 ============================================================
From the file findtext.cc it seems we are not able to get hold of the constructor or any other methods in TextBlock class. Please let me know the changes that are needed to make the above work.
I can do a code clean-up later once the above starts working. regards, Rajesh Marathe. On Fri, Mar 19, 2010 at 10:55 PM, Johannes Hofmann <Johannes.Hofmann@gmx.de>wrote:
Hi,
On Fri, Mar 19, 2010 at 10:26:25AM +0530, Rajesh Marathe wrote:
Hi,
I am trying to implement the support for using the tab or other keyboard keys to set focus on web page links. As part of this, I started out with adding a new Class and would like to use some sort of iterator in this class. I would also like to use the 'Textblock' object to retrieve the style->x_link for a word. However, when I try to initialize the Textblock object in my new class, I get a linker error. The details are as under:
The basic skeletal code for new class is: ======================================== findlinks.cc
namespace dw { namespace core {
FindLinks::FindLinks () { widget = NULL; iterator = NULL;
}
FindLinks::~FindLinks () { if (iterator) delete iterator; }
void FindLinks::getlink (void) { MSG("\n Hi !! I came to findlinks"); Textblock *textblock = new Textblock (false);
}
I have included "dw/textblock.hh" in the above file and also included core.hh.
I guess it's because Textblock is in the dw namespace, not dw::core, so removing "namespace core {" in the above example should fix it. Alternatively you could use "new dw::Textblock (false);".
Compilation goes through but I end up with a linker error as under: ===================================================================== ../dw/libDw-core.a(findlinks.o): In function `dw::core::FindLinks::getlink()': /home/rmarathe/dillo-2.2/dw/findlinks.cc:25: undefined reference to `dw::Textblock::Textblock(bool)' collect2: ld returned 1 exit status
I believe that I still need to use "iterator" and the Textblock" classes to implement this feature. Am I using the Textblock in a right way or am I missing something in the above code ? Please do let me know,
Hm, I can't really tell from the code above. I would expect some code that uses the existing iterator mechanism to walk through a page and find links and buttons, and so on. Maybe you could use findtext.cc as an example.
Regards, Johannes
PS: The keyboard navigation feature would be highly appreciated!
_______________________________________________ Dillo-dev mailing list Dillo-dev@dillo.org http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
Rajesh wrote:
Johannes wrote:
Please let me know the changes that are needed to make the above work.
::dw::Textblock may link...but more importantly...
I would expect some code that uses the existing iterator mechanism to walk through a page and find links and buttons, and so on. Maybe you could use findtext.cc as an example.
As Johannes is saying, and as I detailed in earlier mail ( http://lists.auriga.wearlab.de/pipermail/dillo-dev/2010-March/007396.html ), I would expect the use of iterators. It's not clear to me why you want a Textblock instead, particularly one of your own that isn't part of the page.
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. regards, Rajesh Marathe. On Tue, Mar 23, 2010 at 9:20 PM, corvid <corvid@lavabit.com> wrote:
Rajesh wrote:
Johannes wrote:
Please let me know the changes that are needed to make the above work.
::dw::Textblock may link...but more importantly...
I would expect some code that uses the existing iterator mechanism to walk through a page and find links and buttons, and so on. Maybe you could use findtext.cc as an example.
As Johannes is saying, and as I detailed in earlier mail ( http://lists.auriga.wearlab.de/pipermail/dillo-dev/2010-March/007396.html), I would expect the use of iterators. It's not clear to me why you want a Textblock instead, particularly one of your own that isn't part of the page.
_______________________________________________ Dillo-dev mailing list Dillo-dev@dillo.org http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
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? Cheers, Johannes
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().
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). But then how would we implement visual feedback? We probabely want to highlight the currently selected link somehow. We could for now use changeLinkColor(). What do you think?
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.
But then how would we implement visual feedback? We probabely want to highlight the currently selected link somehow. We could for now use changeLinkColor(). What do you think?
All right.
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.
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
Johannes wrote:
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.
Maybe the focused link can use a highlighting layer in Textblock to show it in inverse video rather than dealing with html and link colors.
On Fri, Mar 26, 2010 at 02:03:08AM +0000, corvid wrote:
Johannes wrote:
<snip>
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.
Maybe the focused link can use a highlighting layer in Textblock to show it in inverse video rather than dealing with html and link colors.
That would be an easy alternative, but I'm investigating how much effort it would be to properly implement the CSS dynmic pseudo classes (:hover, :active, :focus). :focus basically defines how a selected element should look like. E.g: <html> <head> <style type="text/css"> :focus {border: 1px solid green} </style> </head> <body> <a href="foo">foo</a> <a href="bar">bar</a> </body> works in firefox and shows a green border around the currently selected link. With :active anything in the style can be changed, not just the colors.
participants (4)
-
corvid@lavabit.com
-
Johannes.Hofmann@gmx.de
-
rmarathe11@gmail.com
-
rmarathe@i-rode.com