edje: add required attribute in Edje_Part
authorJee-Yong Um <conr2d@gmail.com>
Fri, 15 Jul 2016 07:34:34 +0000 (16:34 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 15 Jul 2016 07:34:34 +0000 (16:34 +0900)
Summary:
When using EDC written by another person, developer usually
does not need to know all specified parts in EDC but editable
like swallow, text or textblock parts.
The required flag tells whether the part is intended to be used outside EDC.

Reviewers: jpeg, cedric, raster, Hermet

Reviewed By: jpeg, raster

Subscribers: raster, NikaWhite, kimcinoo, jpeg

Differential Revision: https://phab.enlightenment.org/D3579

src/bin/edje/edje_cc_handlers.c
src/bin/edje/edje_convert.c
src/bin/edje/edje_convert.h
src/bin/edje/edje_data_convert.c
src/lib/edje/edje_convert.c
src/lib/edje/edje_convert.h
src/lib/edje/edje_data.c
src/lib/edje/edje_private.h

index 7a1b653..1483496 100644 (file)
@@ -294,6 +294,8 @@ static void st_collections_group_parts_part_use_alternate_font_metrics(void);
 static void st_collections_group_parts_part_clip_to_id(void);
 static void st_collections_group_parts_part_render(void);
 static void st_collections_group_parts_part_no_render(void);
+static void st_collections_group_parts_part_required(void);
+static void st_collections_group_parts_part_norequired(void);
 static void st_collections_group_parts_part_source(void);
 static void st_collections_group_parts_part_source2(void);
 static void st_collections_group_parts_part_source3(void);
@@ -768,6 +770,7 @@ New_Statement_Handler statement_handlers[] =
      {"collections.group.parts.part.use_alternate_font_metrics", st_collections_group_parts_part_use_alternate_font_metrics},
      {"collections.group.parts.part.clip_to", st_collections_group_parts_part_clip_to_id},
      {"collections.group.parts.part.no_render", st_collections_group_parts_part_no_render},
+     {"collections.group.parts.part.required", st_collections_group_parts_part_required},
      {"collections.group.parts.part.source", st_collections_group_parts_part_source},
      {"collections.group.parts.part.source2", st_collections_group_parts_part_source2},
      {"collections.group.parts.part.source3", st_collections_group_parts_part_source3},
@@ -1119,6 +1122,8 @@ New_Statement_Handler statement_handlers_short[] =
              noprecise; -> precise_is_inside: 0;
              render; -> no_render: 0;
              norender; -> no_render: 1;
+             required; -> required: 1;
+             norequired; -> norequired: 0;
              scale; -> scale: 1;
              noscale; -> scale: 0;
              desc {
@@ -1147,6 +1152,8 @@ New_Statement_Handler statement_handlers_short_single[] =
      {"collections.group.parts.part.noscale", st_collections_group_parts_part_noscale},
      {"collections.group.parts.part.render", st_collections_group_parts_part_render},
      {"collections.group.parts.part.norender", st_collections_group_parts_part_no_render},
+     {"collections.group.parts.part.required", st_collections_group_parts_part_required},
+     {"collections.group.parts.part.norequired", st_collections_group_parts_part_norequired},
      {"collections.group.parts.part.description.vis", st_collections_group_parts_part_description_vis},
      {"collections.group.parts.part.description.hid", st_collections_group_parts_part_description_hid},
      {"collections.group.mouse", st_collections_group_mouse},
@@ -4395,6 +4402,7 @@ _part_copy(Edje_Part *ep, Edje_Part *ep2)
    ep->multiline = ep2->multiline;
    ep->access = ep2->access;
    ep->no_render = ep2->no_render;
+   ep->required = ep2->required;
    ep->dragable.x = ep2->dragable.x;
    ep->dragable.step_x = ep2->dragable.step_x;
    ep->dragable.count_x = ep2->dragable.count_x;
@@ -5746,6 +5754,7 @@ edje_cc_handlers_part_make(int id)
    ep->access = 0;
    ep->clip_to_id = -1;
    ep->no_render = 0;
+   ep->required = 0;
    ep->dragable.confine_id = -1;
    ep->dragable.threshold_id = -1;
    ep->dragable.event_id = -1;
@@ -6802,6 +6811,33 @@ st_collections_group_parts_part_render(void)
 /**
     @page edcref
     @property
+        required
+    @parameters
+        [1 or 0]
+    @effect
+        If the required flag is set, this part will be considered
+        stable and it is safe to use by any application."
+    @since 1.18
+    @endproperty
+*/
+static void
+st_collections_group_parts_part_required(void)
+{
+   if (check_range_arg_count(0, 1) == 1)
+     current_part->required = parse_bool(0);
+   else /* lazEDC form */
+     current_part->required = EINA_TRUE;
+}
+
+static void
+st_collections_group_parts_part_norequired(void)
+{
+   current_part->required = EINA_FALSE;
+}
+
+/**
+    @page edcref
+    @property
         source
     @parameters
         [another group's name]
index 3d765b0..1a304a1 100644 (file)
@@ -364,6 +364,7 @@ _edje_collection_convert(Eet_File *ef, Edje_Part_Collection_Directory_Entry *ce,
        replacement->select_mode = part->select_mode;
        replacement->multiline = part->multiline;
        replacement->api = part->api;
+       replacement->required = part->required;
 
        edc->parts[k++] = replacement;
 
index eb70163..5e0b63f 100644 (file)
@@ -113,6 +113,7 @@ struct _Old_Edje_Part
    unsigned char          select_mode;
    unsigned char          multiline;
    Edje_Part_Api         api;
+   unsigned char          required;
 };
 
 struct _Old_Edje_Part_Description_Spec_Image
index f417c6a..f35ed94 100644 (file)
@@ -430,6 +430,7 @@ _edje_edd_old_init(void)
    EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part, Old_Edje_Part, "items", items, _edje_edd_old_edje_pack_element);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.name", api.name, EET_T_STRING);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.description", api.description, EET_T_STRING);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "required", required, EET_T_UCHAR);
 
    eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Edje_Part_Collection", sizeof (Old_Edje_Part_Collection));
    _edje_edd_old_edje_part_collection  =
index f70b6ea..c8f0f1b 100644 (file)
@@ -405,6 +405,7 @@ case EDJE_PART_TYPE_##Tp: \
         replacement->select_mode = part->select_mode;
         replacement->multiline = part->multiline;
         replacement->api = part->api;
+        replacement->required = part->required;
 
         edc->parts[k++] = replacement;
 
index 7848efb..be7bac4 100644 (file)
@@ -138,6 +138,7 @@ struct _Old_Edje_Part
    unsigned char          select_mode; /**< entry selection mode */
    unsigned char          multiline; /**< multiline enabled */
    Edje_Part_Api          api; /**< part API */
+   unsigned char          required; /**< required */
 };
 
 /**
index 859a1f3..a2f4a77 100644 (file)
@@ -1762,6 +1762,7 @@ _edje_edd_init(void)
    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_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "nested_children_count", nested_children_count, EET_T_UCHAR);
+   EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "required", required, EET_T_UCHAR);
 
    EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Part_Limit);
    _edje_edd_edje_part_limit = eet_data_descriptor_file_new(&eddc);
index 9faded9..bc25e94 100644 (file)
@@ -1194,6 +1194,7 @@ struct _Edje_Part
    unsigned char          access; /* it will be used accessibility feature */
    unsigned char          nested_children_count;
    unsigned char          no_render; /* for proxy sources and masks, since 1.15 */
+   unsigned char          required; /* required part, since 1.18 */
 };
 
 struct _Edje_Part_Image_Id