allow scale_hint to be added to items in edje
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 7 May 2009 13:30:18 +0000 (13:30 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 7 May 2009 13:30:18 +0000 (13:30 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@40537 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/edje_cc_handlers.c
src/lib/edje_calc.c
src/lib/edje_private.h

index 97a4731..622a759 100644 (file)
@@ -154,6 +154,7 @@ static void st_collections_group_parts_part_description_image_normal(void);
 static void st_collections_group_parts_part_description_image_tween(void);
 static void st_collections_group_parts_part_description_image_border(void);
 static void st_collections_group_parts_part_description_image_middle(void);
+static void st_collections_group_parts_part_description_image_scale_hint(void);
 static void st_collections_group_parts_part_description_fill_smooth(void);
 static void st_collections_group_parts_part_description_fill_origin_relative(void);
 static void st_collections_group_parts_part_description_fill_origin_offset(void);
@@ -349,6 +350,7 @@ New_Statement_Handler statement_handlers[] =
      {"collections.group.parts.part.description.image.images.image", st_images_image}, /* dup */
      {"collections.group.parts.part.description.image.border", st_collections_group_parts_part_description_image_border},
      {"collections.group.parts.part.description.image.middle", st_collections_group_parts_part_description_image_middle},
+     {"collections.group.parts.part.description.image.scale_hint", st_collections_group_parts_part_description_image_scale_hint},
      {"collections.group.parts.part.description.fill.smooth", st_collections_group_parts_part_description_fill_smooth},
      {"collections.group.parts.part.description.fill.origin.relative", st_collections_group_parts_part_description_fill_origin_relative},
      {"collections.group.parts.part.description.fill.origin.offset", st_collections_group_parts_part_description_fill_origin_offset},
@@ -3903,6 +3905,47 @@ st_collections_group_parts_part_description_image_middle(void)
 
 /**
     @page edcref
+    @property
+        scale_hint
+    @parameters
+        0, NANE, DYNAMIC, STATIC
+    @effect
+      Sets the evas image scale hint letting the engine more efectively save
+      cached copies of the scaled image if it maks sense
+    @endproperty
+*/
+static void
+st_collections_group_parts_part_description_image_scale_hint(void)
+{
+   Edje_Part_Collection *pc;
+   Edje_Part *ep;
+   Edje_Part_Description *ed;
+
+   check_arg_count(1);
+
+   pc = eina_list_data_get(eina_list_last(edje_collections));
+   ep = eina_list_data_get(eina_list_last(pc->parts));
+
+   if (ep->type != EDJE_PART_TYPE_IMAGE)
+     {
+       fprintf(stderr, "%s: Error. parse error %s:%i. "
+               "image attributes in non-IMAGE part.\n",
+               progname, file_in, line - 1);
+       exit(-1);
+     }
+
+   ed = ep->default_desc;
+   if (ep->other_desc) ed = eina_list_data_get(eina_list_last(ep->other_desc));
+   ed->image.scale_hint =  parse_enum(0,
+                                    "NONE", EVAS_IMAGE_SCALE_HINT_NONE,
+                                    "DYNAMIC", EVAS_IMAGE_SCALE_HINT_DYNAMIC,
+                                    "STATIC", EVAS_IMAGE_SCALE_HINT_STATIC,
+                                    "0", EVAS_IMAGE_SCALE_HINT_NONE,
+                                    NULL);
+}
+
+/**
+    @page edcref
     @block
         fill
     @context
index 922e8a6..dda6eba 100644 (file)
@@ -1270,7 +1270,6 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
    evas_object_image_fill_set(ep->object, p3->fill.x, p3->fill.y,
                              p3->fill.w, p3->fill.h);
    evas_object_image_smooth_scale_set(ep->object, p3->smooth);
-
    evas_object_image_border_set(ep->object, p3->border.l, p3->border.r,
                                p3->border.t, p3->border.b);
    if (chosen_desc->border.no_fill == 0)
@@ -1551,6 +1550,8 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
          {
           case EDJE_PART_TYPE_RECTANGLE:
           case EDJE_PART_TYPE_IMAGE:
+             evas_object_image_scale_hint_set(ep->object, 
+                                              chosen_desc->image.scale_hint);
           case EDJE_PART_TYPE_TEXTBLOCK:
           case EDJE_PART_TYPE_GRADIENT:
           case EDJE_PART_TYPE_BOX:
index 6d24e0c..b2b1404 100644 (file)
@@ -524,6 +524,7 @@ struct _Edje_Part_Description
    struct {
       Eina_List     *tween_list; /* list of Edje_Part_Image_Id */
       int            id; /* the image id to use */
+      int            scale_hint; /* evas scale hint */
    } image;
 
    struct {
@@ -581,24 +582,24 @@ struct _Edje_Part_Description
       unsigned char  min_y; /* if text size should be part min size */
       unsigned char  max_x; /* if text size should be part max size */
       unsigned char  max_y; /* if text size should be part max size */
-
    } text;
 
    struct {
       char          *layout, *alt_layout;
       Edje_Alignment align;
       struct {
-             int x, y;
+         int x, y;
       } padding;
       struct {
-              Eina_Bool h, v;
+         Eina_Bool h, v;
       } min;
    } box;
+   
    struct {
       unsigned char  homogeneous;
       Edje_Alignment align;
       struct {
-             int x, y;
+         int x, y;
       } padding;
    } table;