diff options
author | Mike Blumenkrantz <zmike@osg.samsung.com> | 2015-04-06 20:42:47 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2015-04-06 20:43:49 -0400 |
commit | d0dcad1ddaa0699984ad2d6a4772503d6661b717 (patch) | |
tree | b9322d91ac149911a4840782d8c35d2042991fa4 /src/bin/edje | |
parent | b8fe6d8cc70a9bccd53a98e7a39ed96163f8f933 (diff) |
edje: allow empty part.desc.inherit; statements to autoinherit default desc
typing inherit: "default"; constantly is annoying and unnecessary.
@feature
Diffstat (limited to 'src/bin/edje')
-rw-r--r-- | src/bin/edje/edje_cc_handlers.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index a8d9d3199a..dcb41a8b84 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c | |||
@@ -1045,6 +1045,7 @@ New_Statement_Handler statement_handlers_short_single[] = | |||
1045 | {"collections.group.nomouse", st_collections_group_nomouse}, | 1045 | {"collections.group.nomouse", st_collections_group_nomouse}, |
1046 | {"collections.group.broadcast", st_collections_group_broadcast}, | 1046 | {"collections.group.broadcast", st_collections_group_broadcast}, |
1047 | {"collections.group.nobroadcast", st_collections_group_nobroadcast}, | 1047 | {"collections.group.nobroadcast", st_collections_group_nobroadcast}, |
1048 | {"collections.group.parts.part.description.inherit", st_collections_group_parts_part_description_inherit}, | ||
1048 | }; | 1049 | }; |
1049 | 1050 | ||
1050 | #define PROGRAM_OBJECTS(PREFIX) \ | 1051 | #define PROGRAM_OBJECTS(PREFIX) \ |
@@ -6397,6 +6398,7 @@ ob_collections_group_parts_part_desc(void) | |||
6397 | named description. The properties defined in this part will override | 6398 | named description. The properties defined in this part will override |
6398 | the inherited properties, reducing the amount of necessary code for | 6399 | the inherited properties, reducing the amount of necessary code for |
6399 | simple state changes. Note: inheritance in Edje is single level only. | 6400 | simple state changes. Note: inheritance in Edje is single level only. |
6401 | @since 1.14 omitting both the description name and index will inherit the default 0.0 description. | ||
6400 | @endproperty | 6402 | @endproperty |
6401 | */ | 6403 | */ |
6402 | static void | 6404 | static void |
@@ -6408,7 +6410,7 @@ st_collections_group_parts_part_description_inherit(void) | |||
6408 | Edje_Part_Image_Id *iid; | 6410 | Edje_Part_Image_Id *iid; |
6409 | char *parent_name; | 6411 | char *parent_name; |
6410 | const char *state_name; | 6412 | const char *state_name; |
6411 | double parent_val, state_val; | 6413 | double parent_val = 0.0, state_val; |
6412 | 6414 | ||
6413 | pc = eina_list_data_get(eina_list_last(edje_collections)); | 6415 | pc = eina_list_data_get(eina_list_last(edje_collections)); |
6414 | ep = current_part; | 6416 | ep = current_part; |
@@ -6417,8 +6419,6 @@ st_collections_group_parts_part_description_inherit(void) | |||
6417 | parent = parent_desc; | 6419 | parent = parent_desc; |
6418 | if (!parent) | 6420 | if (!parent) |
6419 | { | 6421 | { |
6420 | check_min_arg_count(1); | ||
6421 | |||
6422 | /* inherit may not be used in the default description */ | 6422 | /* inherit may not be used in the default description */ |
6423 | if (!ep->other.desc_count) | 6423 | if (!ep->other.desc_count) |
6424 | { | 6424 | { |
@@ -6429,11 +6429,21 @@ st_collections_group_parts_part_description_inherit(void) | |||
6429 | } | 6429 | } |
6430 | 6430 | ||
6431 | /* find the description that we inherit from */ | 6431 | /* find the description that we inherit from */ |
6432 | parent_name = parse_str(0); | 6432 | switch (get_arg_count()) |
6433 | if (get_arg_count() == 2) | 6433 | { |
6434 | parent_val = parse_float_range(1, 0.0, 1.0); | 6434 | case 0: |
6435 | else | 6435 | parent_name = strdup("default"); |
6436 | parent_val = 0.0; | 6436 | break; |
6437 | case 2: | ||
6438 | parent_val = parse_float_range(1, 0.0, 1.0); | ||
6439 | case 1: | ||
6440 | parent_name = parse_str(0); | ||
6441 | break; | ||
6442 | default: | ||
6443 | ERR("parse error %s:%i. too many parameters", | ||
6444 | file_in, line - 1); | ||
6445 | exit(-1); | ||
6446 | } | ||
6437 | 6447 | ||
6438 | if (!strcmp (parent_name, "default") && parent_val == 0.0) | 6448 | if (!strcmp (parent_name, "default") && parent_val == 0.0) |
6439 | parent = ep->default_desc; | 6449 | parent = ep->default_desc; |