Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src


Modified Files:
        ewl_media.c ewl_media.h 


Log Message:
Some changes to ewl_media to allow preferred size to be sanely calculated and
for allowing the source to be set prior to realize time.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_media.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ewl_media.c 15 Jul 2004 14:19:56 -0000      1.1
+++ ewl_media.c 16 Jul 2004 00:04:43 -0000      1.2
@@ -1,5 +1,7 @@
 #include <Ewl.h>
 
+static void ewl_media_size_update(Ewl_Media *m);
+
 /**
  * @return Returns a pointer to a new media on success, NULL on failure.
  * @brief Allocate a new media widget
@@ -61,13 +63,15 @@
        DCHECK_PARAM_PTR("m", m);
        DCHECK_PARAM_PTR("media", media);
 
-       media = strdup(media);
+       m->media = strdup(media);
 
        /*
         * Update the emotion to the new file
         */
-       if (m->video) 
-               emotion_object_file_set(m->video, media);
+       if (m->video) {
+               emotion_object_file_set(m->video, m->media);
+               ewl_media_size_update(m);
+       }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -84,8 +88,8 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("m", m, NULL);
 
-       if (m->video)
-               txt = (char *)emotion_object_file_get(m->video);
+       if (m->media)
+               txt = strdup(m->media);
 
        DRETURN_PTR(txt, DLEVEL_STABLE);
 }
@@ -267,6 +271,10 @@
         * Create the emotion
         */
        m->video = emotion_object_add(emb->evas);
+       if (m->media) {
+               emotion_object_file_set(m->video, m->media);
+               ewl_media_size_update(m);
+       }
 
        if (w->fx_clip_box)
                evas_object_clip_set(m->video, w->fx_clip_box);
@@ -315,4 +323,11 @@
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
-
+static void ewl_media_size_update(Ewl_Media *m)
+{
+       int width, height;
+       emotion_object_size_get(m->video, &width, &height);
+       if (width && height)
+               ewl_object_set_preferred_size(EWL_OBJECT(m->video),
+                               width, height);
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_media.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ewl_media.h 15 Jul 2004 14:19:56 -0000      1.1
+++ ewl_media.h 16 Jul 2004 00:04:43 -0000      1.2
@@ -28,6 +28,7 @@
 {
        Ewl_Widget      widget;       /**< Inherit from Ewl_Widget */
        Evas_Object    *video;        /**< Emotion does the actual work */
+       char           *media;        /**< Path to the media file */
 };
 
 Ewl_Widget  *ewl_media_new();




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to