On Feb 11, 2008 3:02 AM, Jess <[EMAIL PROTECTED]> wrote:
> Hi Gustavo!
>   Thanks for replying.  I have two basic images, web_browser.png and
> hotspot.png.  I have one group defined as main, and have the two images as
> seperate parts, with mutliple descriptions (states) each.  Currently, for each
> image, I have a couple of program blocks defined to allow the mouse to change
> the back coloring of the image.  I also have both defined to allow the drag
> behavior.  What I would like to do, is if one of the images has come into
> contact with the other via a drag operation, change the color.  Its a very
> basic test case for me to incorporate into another app I am tinkering on.

In a simple example you could do in embryo, yes, just get_drag() and
do the math, issuing state_set() or emit(). (see
usr/share/edje/include/edje.inc, and remember embryo is not C, no need
to add & to your parameters, it's just required in the function
declaration).

However, evolving to real world app, you better move this logic to
C/Python/Ruby... even the move/positioning of objects. Create an evas
Smart object that is a container of children, move the children
relative to this container and you'll get a portable component that
can be reused.
   If you opt to use Python, I provide evas.ClippedSmartObject, it
implement the recommended way of using smart objects and it's much
easier than doing it yourself, since it uses a clip for most
operations (clip_set, color_set, hide, show all apply to the clipper),
move have a default implementation to move all children relatively and
delete will delete all children. Basically you just want to implement
the resize() method to do something when the object is resized (no way
to do a general version of it). It also provide primitive object
factories to easy the registration of children, so you can do self.r =
self.Rectangle(...), instead of self.r = evas.Rectangle(self.evas,
...); self.member_add(self.r)
   See 
http://www.enlightenment.org/viewvc/e17/proto/python-efl/python-evas/examples/01-smart_object.py?view=markup


> I have done some programming in Evas, and was able to get drag and drop, etc 
> to
> work, but had problems refreshing the screen.  While digging around with that 
> I
> came across Edje and instantly fell into using it.  I haven't done much with
> interacting with the objects via code directly, although I have seen some
> sample code of others doing it.  Should I be doing the calculations using C?  
> I
> am not C heavy, but have the basic understanding and years of just kicking it
> around, so could do it, but if its easier to do with Embryo, I wouldn't mind
> that route ;-).

It's better to handle that in C/Python/Ruby/whatever :-)


> I have also built the final app to use the CPP macros as I had seen someone 
> else
> doing that (Could've been your iPhone keyboard, kudos btw).

That's exactly the reason I say to no use CPP macros :-) I've done, I
know the pain to keep with it, but I was learning, so...


> These are the settings I am using for the group as a whole.  I also have a
> background image defined, but its pretty much the same (other than the actual
> image) as the samples in the docs.
>
> name: "main";
> min: 350 350;
> max: 350 350;
>
> Here is how the image part is defined for the web_browser (were taken from the
> E17 built in icons )
> part {
>     name: "web_browser";
>     type: IMAGE;
>     mouse_events: 1;
>     // The following makes the image "draggable"
>     dragable { x: 1 0 0; y: 1 0 0; }
>     description {
>        visible: 1;
>        state: "default" 0.0;
>        rel1 { relative: 0.05 0.05; offset: 0 0; }
>        rel2 { relative: 0.27 0.27; offset: 0 0; }
>        image { normal: "web_browser.png"; }
>     }
>     description {
>        state: "hover" 0.0;
>        inherit: "default" 0.0;
>     }
>     description {
>        state: "drag" 0.0;
>        inherit: "default" 0.0;
>        color: 255 201 195 255;
>     }
> }
>
> And below is the hotspot definition:
> part {
>    name: "hotspot";
>    type: IMAGE;
>    mouse_events: 1;
>    dragable { x: 1 0 0; y: 1 0 0; }
>    description {
>       state: "default" 0.0;
>       min: 224 147;
>       max: 224 147;
>       rel1 { relative: 0.29 0.52; offset: -100 0; }
>       rel2 { relative: 0.12 0.85; offset: 0 0; }
>       image { normal: "hotspot.png"; }
>       visible: 1;
>    }
>    description {
>       state: "mouse_in" 0.0;
>       inherit: "default" 0.0;
>       color: 255 211 149 254;
>    }
> }
>
>
> I have basic mouse in/out/down/up functionality as described in the EFL
> Cookbook and EDC guides, and went with the non-embryo version (I have done 
> both
> in testing).  The program definitions are below, these are very basic.  I have
> tried many times to incorporate embryo, but I haven't seemed to figure out the
> debugging tricks yet, and so am not sure what values are being passed around.

Embryo/Edje debugging is weird to beginners, since we have no
gdb/debugger or printf(), how to do it? People told me to use:

    emit("dbg", "some value");

then you need to catch signals from your app:

   void edje_dbg(void *data, Evas_Object *obj, const char *s, const char *e) {
      fprintf(stderr, "DBG: %p %s\n", obj, e);
   }

    edje_object_signal_callback_add(obj, "dbg", "*", edje_dbg, NULL);

Of course if you want to emit() some run-time value, you need to use
embryo's snprintf() to create the string.

>                 program {
>                    name: "mouse_in_web_browser";
>                    signal: "mouse,in";
>                    source: "web_browser";
>                    action: STATE_SET "hover" 0.0;
>                    target: "web_browser";
>                 }
>                 program {
>                    name: "mouse_out_web_browser";
>                    signal: "mouse,out";
>                    source: "web_browser";
>                    action: STATE_SET "default" 0.0;
>                    target: "web_browser";
>                 }
>                 program {
>                    name: "mouse_down_web_browser";
>                    signal: "mouse,down,*";
>                    source: "web_browser";
>                    action: STATE_SET "drag" 0.0;
>                    target: "web_browser";
>                 }
>                 program {
>                    name: "mouse_up_web_browser";
>                    signal: "mouse,up,*";
>                    source: "web_browser";
>                    action: STATE_SET "hover" 0.0;
>                    target: "web_browser";
>                 }
>
>
> On another note, more for the group than anything.  If I could be of help, I'd
> really like to get involved.  Like everyone here, I work tons of hours, but
> could help out in the way of documentation or testing or something.  Contact
> me if there is something someone needs done, grunt work wise.

We really lack tutorial writers. While Andres Blanc is writing more
technical docs, like for C and Edje sections, we still have just few
introductory tutorials, you see you miss them... :-) Rephorm have some
great docs, but we could use more of that.

-- 
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: [EMAIL PROTECTED]
   MSN: [EMAIL PROTECTED]
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to