[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] Evas Smart objects



On Mon, Jun 19, 2006 at 01:17:03AM +0200, Jorge Luis Zapata Muga wrote:
> Hi all,
> i have some doubts-ideas about evas smart objects,
> 
> 1. the API
> in order to add an object to a smart object you have to do
> _member_add(o, s) and to delete _member_del(o,s). On the code of both
> an evas smart object actually stores the members on a list but theres
> no function to retrieve them, Evas_List * _members_get(s), so when you
> code an evas smart obejct and you need to keep track of the objects
> you have, you need to duplicate the list and code a different function
> to do that.

Adding api to get the member list makes sense to me. Simple enough to
do, and would solve the issues you mentioned here.

> 
> 2. the implementation
> ive been playing with smart objects for evoak, so ill explain the case:
> my goal was to create a container, an evas objects container. the
> problem i see is that the evas smart objects where thought for a
> static environment, on the callback of a smart object add you create
> the static objects inside, store them on your list and when something
> happens (move, resize, whatever) you act accord with that and apply
> that to your internal objects. thats fine. but i thought the idea of
> the smart objects was to actually be a sub canvas of evas, so when you
> add an object: evas_object_add(evas) and then add it as a member of
> smart object it is no longer part of the evas objects but of the smart
> objects, so for example a layer change on that is actually a layer
> change inside the layers of the sub canvas, wich in fact the subcanvas
> is in one layer. but not in the evas canvas layers. another example is
> that when you move an object what is member of a smart object it
> should move relative to it, no relative to the evas canvas. dont know
> if i explain myself correctly :)
> so a problem with this is that if you want to move an object that is
> part of smart object you should call a different (own) function to
> calculate all the relative coordinates and move it there.

I'm not sure I quite understand what you're trying to do exactly.
Smart objects are not a sub-canvas, although they could be implemented
in such a way. Right now, the members stay as normal objects in the main
canvas. So, yes, you need to transform you local smart object relative
coordinates to canvas ones. Although slightly inconvenient, I don't see
this as a real issue.

As for layering, I believe evas handles smart object memeber layering
different from 'normal' objects. As far as I know, it keeps them
together so that they cannot interleave. I haven't looked at the actual
implementation of this though. In your theoretical subcanvas
implementation, this would be more clearly enforced.

>
> so my question is, the current aproach of evas smart objects in the
> correct way? or my use case is just an specific and doesnt make sense
> to change the behaviour of the smart objects?
> maybe a solution could be to add callbacks for a move, resize,
> layer_set, whatever, but not for the smart object but for the elements
> of a smart object.

The current way probably isn't the most ideal, but I think the answer
you're going to get will be along the lines of "It works for everything
we need now. Maybe after e17 is released we can go back and improve
things." :)

--
rephorm