Just curious.
What is the usecase of this feature?

Daniel Juyung Seo (SeoZ)

On Sun, Jun 24, 2012 at 10:23 PM, Enlightenment SVN
<[email protected]> wrote:
> Log:
> edje: implement per part limit.
>
>
> Author:       cedric
> Date:         2012-06-24 06:23:37 -0700 (Sun, 24 Jun 2012)
> New Revision: 72767
> Trac:         http://trac.enlightenment.org/e/changeset/72767
>
> Modified:
>  trunk/edje/ChangeLog trunk/edje/NEWS trunk/edje/src/bin/edje_cc_handlers.c 
> trunk/edje/src/lib/edje_calc.c trunk/edje/src/lib/edje_data.c 
> trunk/edje/src/lib/edje_private.h
>
> Modified: trunk/edje/ChangeLog
> ===================================================================
> --- trunk/edje/ChangeLog        2012-06-24 13:18:35 UTC (rev 72766)
> +++ trunk/edje/ChangeLog        2012-06-24 13:23:37 UTC (rev 72767)
> @@ -490,14 +490,18 @@
>
>        * Add edje_object_access_part_list_get and acess flags in edc file.
>
> -2012-05-21 Carsten Haitzler (The Rasterman)
> +2012-06-21  Carsten Haitzler (The Rasterman)
>
>         * Improve edje_cc slightly to use prefix for full path to
>         embryo_cc. this still like before requires embryo and edje to share
>         the same install prefix for edje_cc to work.
>
> -2012-06-12 Michael Bouchaud (yoz)
> +2012-06-12  Michael Bouchaud (yoz)
>
>        * The aliases are now inherited from the targeted group
>        * Aliases can be usable with edje programs, if the part is in the
>        group
> +
> +2012-06-24  Cedric Bail
> +
> +       * Emit signal for flagged part when their size get to zero.
>
> Modified: trunk/edje/NEWS
> ===================================================================
> --- trunk/edje/NEWS     2012-06-24 13:18:35 UTC (rev 72766)
> +++ trunk/edje/NEWS     2012-06-24 13:23:37 UTC (rev 72767)
> @@ -10,6 +10,7 @@
>     * Add SPACER part. This part are not putting anything into the canvas. So 
> lighter and faster to
>     process (Use it to replace RECT part that are never visible and never 
> catch any event).
>     * Add accessibility flags and API to retrieve the relevant part.
> +    * Emit signal when flagged part size get to zero.
>
>  Improvements:
>     * Allocate once and reuse Evas_Map.
>
> Modified: trunk/edje/src/bin/edje_cc_handlers.c
> ===================================================================
> --- trunk/edje/src/bin/edje_cc_handlers.c       2012-06-24 13:18:35 UTC (rev 
> 72766)
> +++ trunk/edje/src/bin/edje_cc_handlers.c       2012-06-24 13:23:37 UTC (rev 
> 72767)
> @@ -171,6 +171,7 @@
>  static void st_collections_group_parts_part_description_source(void);
>  static void st_collections_group_parts_part_description_state(void);
>  static void st_collections_group_parts_part_description_visible(void);
> +static void st_collections_group_parts_part_description_limit(void);
>  static void st_collections_group_parts_part_description_align(void);
>  static void st_collections_group_parts_part_description_fixed(void);
>  static void st_collections_group_parts_part_description_min(void);
> @@ -436,6 +437,7 @@
>      {"collections.group.parts.part.description.source", 
> st_collections_group_parts_part_description_source},
>      {"collections.group.parts.part.description.state", 
> st_collections_group_parts_part_description_state},
>      {"collections.group.parts.part.description.visible", 
> st_collections_group_parts_part_description_visible},
> +     {"collections.group.parts.part.description.limit", 
> st_collections_group_parts_part_description_limit},
>      {"collections.group.parts.part.description.align", 
> st_collections_group_parts_part_description_align},
>      {"collections.group.parts.part.description.fixed", 
> st_collections_group_parts_part_description_fixed},
>      {"collections.group.parts.part.description.min", 
> st_collections_group_parts_part_description_min},
> @@ -2258,7 +2260,6 @@
>    Edje_Pack_Element_Parser *pitem;
>    Edje_Part_Description_Common *ed, *ed2;
>    Edje_List_Foreach_Data fdata;
> -   Edje_String *es;
>    Eina_List *l;
>    char *parent_name;
>    unsigned int i, j;
> @@ -4260,6 +4261,7 @@
>      }
>
>    ed->visible = 1;
> +   ed->limit = 0;
>    ed->align.x = FROM_DOUBLE(0.5);
>    ed->align.y = FROM_DOUBLE(0.5);
>    ed->min.w = 0;
> @@ -4673,7 +4675,43 @@
>
>    current_desc->visible = parse_bool(0);
>  }
> +/**
> +    @page edcref
> +    @property
> +        limit
> +    @parameters
> +        [NONE, WIDTH, HEIGHT or BOTH]
> +    @effect
> +       Emit a signal when the part size change from zero or to a zero size
> +       ('limit,width,over', 'limit,width,zero'). By default no signal are
> +       emitted.
> +    @endproperty
> +*/
> +static void
> +st_collections_group_parts_part_description_limit(void)
> +{
> +   check_arg_count(1);
>
> +   current_desc->limit = parse_enum(0,
> +                                   "NONE", 0,
> +                                   "WIDTH", 1,
> +                                   "HEIGHT", 2,
> +                                   "BOTH", 3);
> +
> +   if (current_desc->limit)
> +     {
> +        Edje_Part_Collection *pc;
> +        int count;
> +
> +        pc = eina_list_data_get(eina_list_last(edje_collections));
> +        count = pc->limits.parts_count++;
> +        pc->limits.parts = realloc(pc->limits.parts,
> +                                   pc->limits.parts_count * sizeof 
> (Edje_Part_Limit));
> +        data_queue_part_lookup(pc, current_part->name,
> +                               &(pc->limits.parts[count].part));
> +     }
> +}
> +
>  /**
>     @page edcref
>     @property
>
> Modified: trunk/edje/src/lib/edje_calc.c
> ===================================================================
> --- trunk/edje/src/lib/edje_calc.c      2012-06-24 13:18:35 UTC (rev 72766)
> +++ trunk/edje/src/lib/edje_calc.c      2012-06-24 13:23:37 UTC (rev 72767)
> @@ -667,6 +667,79 @@
>         edje_object_size_min_calc(ed->obj, &w, &h);
>         evas_object_size_hint_min_set(ed->obj, w, h);
>      }
> +
> +   if (!ed->collection) return ;
> +
> +   for (i = 0; i < ed->collection->limits.parts_count; i++)
> +     {
> +        const char *name;
> +        unsigned char limit;
> +        int part;
> +
> +        name = ed->collection->parts[i]->name;
> +        part = ed->collection->limits.parts[i].part;
> +        limit = ed->table_parts[part]->chosen_description->limit;
> +        switch (limit)
> +          {
> +           case 0:
> +              ed->collection->limits.parts[i].width = 2;
> +              ed->collection->limits.parts[i].height = 2;
> +              break;
> +           case 1:
> +              ed->collection->limits.parts[i].height = 2;
> +              break;
> +           case 2:
> +              ed->collection->limits.parts[i].width = 2;
> +              break;
> +           case 3:
> +              break;
> +          }
> +
> +        if (limit | 1)
> +          {
> +             if (ed->table_parts[part]->w > 0 &&
> +                 (ed->collection->limits.parts[i].width <= 0 ||
> +                  ed->collection->limits.parts[i].width == 2))
> +               {
> +                  ed->collection->limits.parts[i].width = 1;
> +                  _edje_emit(ed, "limit,width,over", name);
> +               }
> +             else if (ed->table_parts[part]->w < 0 &&
> +                      ed->collection->limits.parts[i].width >= 0)
> +               {
> +                  ed->collection->limits.parts[i].width = -1;
> +                  _edje_emit(ed, "limit,width,below", name);
> +               }
> +             else if (ed->table_parts[part]->w == 0 &&
> +                      ed->collection->limits.parts[i].width != 0)
> +               {
> +                  ed->collection->limits.parts[i].width = 0;
> +                  _edje_emit(ed, "limit,width,zero", name);
> +               }
> +          }
> +        if (limit | 2)
> +          {
> +             if (ed->table_parts[part]->h > 0 &&
> +                 (ed->collection->limits.parts[i].height <= 0 ||
> +                  ed->collection->limits.parts[i].height == 2))
> +               {
> +                  ed->collection->limits.parts[i].height = 1;
> +                  _edje_emit(ed, "limit,height,over", name);
> +               }
> +             else if (ed->table_parts[part]->h < 0 &&
> +                      ed->collection->limits.parts[i].height >= 0)
> +               {
> +                  ed->collection->limits.parts[i].height = -1;
> +                  _edje_emit(ed, "limit,height,beloh", name);
> +               }
> +             else if (ed->table_parts[part]->h == 0 &&
> +                      ed->collection->limits.parts[i].height != 0)
> +               {
> +                  ed->collection->limits.parts[i].height = 0;
> +                  _edje_emit(ed, "limit,height,zero", name);
> +               }
> +          }
> +     }
>  }
>
>  void
>
> Modified: trunk/edje/src/lib/edje_data.c
> ===================================================================
> --- trunk/edje/src/lib/edje_data.c      2012-06-24 13:18:35 UTC (rev 72766)
> +++ trunk/edje/src/lib/edje_data.c      2012-06-24 13:23:37 UTC (rev 72767)
> @@ -55,6 +55,7 @@
>  Eet_Data_Descriptor *_edje_edd_edje_part_image_id = NULL;
>  Eet_Data_Descriptor *_edje_edd_edje_part_image_id_pointer = NULL;
>  Eet_Data_Descriptor *_edje_edd_edje_external_param = NULL;
> +Eet_Data_Descriptor *_edje_edd_edje_part_limit = NULL;
>
>  #define EMP(Type, Minus)                               \
>   Eina_Mempool *_emp_##Type = NULL;                    \
> @@ -218,6 +219,7 @@
>    FREED(_edje_edd_edje_external_param);
>    FREED(_edje_edd_edje_image_directory_set);
>    FREED(_edje_edd_edje_image_directory_set_entry);
> +   FREED(_edje_edd_edje_part_limit);
>  }
>
>  #define EDJE_DEFINE_POINTER_TYPE(Type, Name)                           \
> @@ -454,6 +456,7 @@
>       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.name", state.name, 
> EET_T_STRING); \
>       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "state.value", state.value, 
> EET_T_DOUBLE); \
>       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "visible", visible, 
> EET_T_CHAR); \
> +      EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "limit", limit, EET_T_CHAR); \
>       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.x", align.x, 
> EDJE_T_FLOAT); \
>       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "align.y", align.y, 
> EDJE_T_FLOAT); \
>       EET_DATA_DESCRIPTOR_ADD_BASIC(Edd, Type, "fixed.w", fixed.w, 
> EET_T_UCHAR); \
> @@ -867,6 +870,11 @@
>    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "api.name", 
> api.name, EET_T_STRING);
>    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, 
> "api.description", api.description, EET_T_STRING);
>
> +   EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Limit);
> +   _edje_edd_edje_part_limit = eet_data_descriptor_file_new(&eddc);
> +
> +   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_limit, Edje_Part_Limit, 
> "part", part, EET_T_INT);
> +
>    EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Collection);
>    _edje_edd_edje_part_collection  =
>      eet_data_descriptor_file_new(&eddc);
> @@ -884,6 +892,7 @@
>    EDJE_DEFINE_POINTER_TYPE(Limit, limit);
>    EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, 
> Edje_Part_Collection, "limits.vertical", limits.vertical, 
> _edje_edd_edje_limit_pointer);
>    EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, 
> Edje_Part_Collection, "limits.horizontal", limits.horizontal, 
> _edje_edd_edje_limit_pointer);
> +   EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_edje_edd_edje_part_collection, 
> Edje_Part_Collection, "limits.parts", limits.parts, 
> _edje_edd_edje_part_limit);
>
>    EET_DATA_DESCRIPTOR_ADD_HASH(_edje_edd_edje_part_collection, 
> Edje_Part_Collection, "data", data, _edje_edd_edje_string);
>    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, 
> Edje_Part_Collection, "id", id, EET_T_INT);
>
> Modified: trunk/edje/src/lib/edje_private.h
> ===================================================================
> --- trunk/edje/src/lib/edje_private.h   2012-06-24 13:18:35 UTC (rev 72766)
> +++ trunk/edje/src/lib/edje_private.h   2012-06-24 13:23:37 UTC (rev 72767)
> @@ -195,7 +195,7 @@
>  /* increment this when you add new feature to edje file format without
>  * breaking backward compatibility.
>  */
> -#define EDJE_FILE_MINOR 3
> +#define EDJE_FILE_MINOR 4
>
>  /* FIXME:
>  *
> @@ -321,6 +321,7 @@
>  typedef struct _Edje_Part_Description_Spec_Table     
> Edje_Part_Description_Spec_Table;
>  typedef struct _Edje_Patterns                        Edje_Patterns;
>  typedef struct _Edje_Part_Box_Animation              Edje_Part_Box_Animation;
> +typedef struct _Edje_Part_Limit                      Edje_Part_Limit;
>
>  typedef struct _Edje Edje;
>  typedef struct _Edje_Real_Part_State Edje_Real_Part_State;
> @@ -726,6 +727,14 @@
>    unsigned short   colspan, rowspan;
>  };
>
> +struct _Edje_Part_Limit
> +{
> +   int part;
> +
> +   signed char width; /* -1, 0 or 1 */
> +   signed char height; /* -1, 0, or 1 */
> +};
> +
>  /*----------*/
>
>  struct _Edje_Part_Collection
> @@ -753,6 +762,9 @@
>
>       Edje_Limit **horizontal;
>       unsigned int horizontal_count;
> +
> +      Edje_Part_Limit *parts;
> +      unsigned int parts_count;
>    } limits;
>
>    Edje_Part **parts; /* an array of Edje_Part */
> @@ -914,6 +926,7 @@
>    } persp;
>
>    unsigned char     visible; /* is it shown */
> +   unsigned char     limit; /* 0 == no, 1 = width, 2 = height, 3 = both */
>  };
>
>  struct _Edje_Part_Description_Spec_Fill
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> enlightenment-svn mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to