RE: [Inkscape-devel] shift+click to select broken
On Fri, 2003-12-19 at 21:42, bulia byak wrote:
There's a really simple way of doing this. Every desktop has an integer 'key' associated with it, that you can use to match against SPItemView::key.
Does not work: if child is an SPItem then child->display->arenaitem->key exists but is always 0. Or am I doing something wrong?
No, use child->display->key ... or, actually, since as I said child->display is the head of a linked list:
SPItemView *iv; NRArenaItem *arenaitem;
arenaitem = NULL; for ( iv = child->display ; iv ; iv = iv->next ) { if ( iv->key == dkey ) { arenaitem = iv->arenaitem; break; } }
.. then use arenaitem as appropriate. (dkey being the dkey you got from the SPDesktop, of course)
-mental
On Fri, 2003-12-19 at 23:15, MenTaLguY wrote:
SPItemView *iv; NRArenaItem *arenaitem;
arenaitem = NULL; for ( iv = child->display ; iv ; iv = iv->next ) { if ( iv->key == dkey ) { arenaitem = iv->arenaitem; break; } }
Thinking about it, this snippet of code would probably be best wrapped as e.g. NRArenaItem *sp_item_get_arenaitem (SPItem *item, unsigned int key). (unless there's already an equivalent there that I'm missing?)
I'm sure there will be other times we'll want to reuse it, and SPItemViews are really not supposed to be part of SPItem's external interface anyway.
-mental
participants (1)
-
MenTaLguY