diff options
author | Mike Blumenkrantz <zmike@osg.samsung.com> | 2015-03-07 13:38:57 -0500 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2015-03-07 13:44:52 -0500 |
commit | 1cf630f2bdedfd6b50c88ee1024b9bb03c0d1c39 (patch) | |
tree | 4fd0cbfd167c7142d2d65b4ea5d49a713d4b8674 /src | |
parent | 54fa8c7e423022fb461ff7e2a49855b77176e1ed (diff) |
edje color classes can now have text descriptions
@feature
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/edje/edje_cc_handlers.c | 26 | ||||
-rw-r--r-- | src/lib/edje/Edje_Edit.h | 20 | ||||
-rw-r--r-- | src/lib/edje/edje_data.c | 1 | ||||
-rw-r--r-- | src/lib/edje/edje_edit.c | 37 | ||||
-rw-r--r-- | src/lib/edje/edje_load.c | 1 | ||||
-rw-r--r-- | src/lib/edje/edje_object.eo | 12 | ||||
-rw-r--r-- | src/lib/edje/edje_private.h | 1 | ||||
-rw-r--r-- | src/lib/edje/edje_smart.c | 1 | ||||
-rw-r--r-- | src/lib/edje/edje_util.c | 7 |
9 files changed, 105 insertions, 1 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index 6d96fd27fe..303bd4523f 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c | |||
@@ -205,6 +205,7 @@ static void st_color_class_name(void); | |||
205 | static void st_color_class_color(void); | 205 | static void st_color_class_color(void); |
206 | static void st_color_class_color2(void); | 206 | static void st_color_class_color2(void); |
207 | static void st_color_class_color3(void); | 207 | static void st_color_class_color3(void); |
208 | static void st_color_class_desc(void); | ||
208 | 209 | ||
209 | static void ob_collections(void); | 210 | static void ob_collections(void); |
210 | static void st_collections_base_scale(void); | 211 | static void st_collections_base_scale(void); |
@@ -498,7 +499,8 @@ static void st_collections_group_nobroadcast(void); | |||
498 | {PREFIX"color_classes.color_class.name", st_color_class_name}, /* dup */ \ | 499 | {PREFIX"color_classes.color_class.name", st_color_class_name}, /* dup */ \ |
499 | {PREFIX"color_classes.color_class.color", st_color_class_color}, /* dup */ \ | 500 | {PREFIX"color_classes.color_class.color", st_color_class_color}, /* dup */ \ |
500 | {PREFIX"color_classes.color_class.color2", st_color_class_color2}, /* dup */ \ | 501 | {PREFIX"color_classes.color_class.color2", st_color_class_color2}, /* dup */ \ |
501 | {PREFIX"color_classes.color_class.color3", st_color_class_color3}, /* dup */ | 502 | {PREFIX"color_classes.color_class.color3", st_color_class_color3}, /* dup */ \ |
503 | {PREFIX"color_classes.color_class.description", st_color_class_desc}, /* dup */ | ||
502 | 504 | ||
503 | #define PROGRAM_SEQUENCE(PREFIX, NAME, FN) \ | 505 | #define PROGRAM_SEQUENCE(PREFIX, NAME, FN) \ |
504 | {PREFIX".program."NAME, FN}, /* dup */ \ | 506 | {PREFIX".program."NAME, FN}, /* dup */ \ |
@@ -2460,6 +2462,28 @@ st_color_class_color3(void) | |||
2460 | cc->a3 = parse_int_range(3, 0, 255); | 2462 | cc->a3 = parse_int_range(3, 0, 255); |
2461 | } | 2463 | } |
2462 | 2464 | ||
2465 | /** | ||
2466 | @page edcref | ||
2467 | @property | ||
2468 | description | ||
2469 | @parameters | ||
2470 | [color class description] | ||
2471 | @effect | ||
2472 | Provides a descriptive name for the effect of the color class | ||
2473 | @since 1.14 | ||
2474 | @endproperty | ||
2475 | */ | ||
2476 | static void | ||
2477 | st_color_class_desc(void) | ||
2478 | { | ||
2479 | Edje_Color_Class *cc; | ||
2480 | |||
2481 | check_arg_count(1); | ||
2482 | |||
2483 | cc = eina_list_data_get(eina_list_last(edje_file->color_classes)); | ||
2484 | cc->desc = parse_str(0); | ||
2485 | } | ||
2486 | |||
2463 | /** @edcsubsection{toplevel_styles, | 2487 | /** @edcsubsection{toplevel_styles, |
2464 | * Styles} */ | 2488 | * Styles} */ |
2465 | 2489 | ||
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index d43d434a77..249ed3c683 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h | |||
@@ -813,6 +813,26 @@ EAPI Eina_Bool edje_edit_color_class_colors_set(Evas_Object *obj, const char *cl | |||
813 | */ | 813 | */ |
814 | EAPI Eina_Bool edje_edit_color_class_name_set(Evas_Object *obj, const char *name, const char *newname); | 814 | EAPI Eina_Bool edje_edit_color_class_name_set(Evas_Object *obj, const char *name, const char *newname); |
815 | 815 | ||
816 | /** Get the description of a color class. | ||
817 | * | ||
818 | * @param obj Object being edited. | ||
819 | * @param name Color class to get the description of. | ||
820 | * | ||
821 | * @return The description of the color class or @c NULL if not found | ||
822 | * @since 1.14 | ||
823 | */ | ||
824 | EAPI Eina_Stringshare *edje_edit_color_class_description_get(Evas_Object *obj, const char *class_name); | ||
825 | |||
826 | /** Change the description of a color class. | ||
827 | * | ||
828 | * @param obj Object being edited. | ||
829 | * @param name Color class to edit. | ||
830 | * @param desc New description for the color class | ||
831 | * | ||
832 | * @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise. | ||
833 | * @since 1.14 | ||
834 | */ | ||
835 | EAPI Eina_Bool edje_edit_color_class_description_set(Evas_Object *obj, const char *class_name, const char *desc); | ||
816 | //@} | 836 | //@} |
817 | 837 | ||
818 | 838 | ||
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c index 774d9c2e4d..f18637e1be 100644 --- a/src/lib/edje/edje_data.c +++ b/src/lib/edje/edje_data.c | |||
@@ -418,6 +418,7 @@ _edje_edd_init(void) | |||
418 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "g3", g3, EET_T_UCHAR); | 418 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "g3", g3, EET_T_UCHAR); |
419 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "b3", b3, EET_T_UCHAR); | 419 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "b3", b3, EET_T_UCHAR); |
420 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "a3", a3, EET_T_UCHAR); | 420 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "a3", a3, EET_T_UCHAR); |
421 | EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_color_class, Edje_Color_Class, "desc", desc, EET_T_STRING); | ||
421 | 422 | ||
422 | /* the main file directory */ | 423 | /* the main file directory */ |
423 | EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_File); | 424 | EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_File); |
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 5687e3e9d9..faf5673c46 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c | |||
@@ -2519,6 +2519,43 @@ edje_edit_color_class_colors_set(Evas_Object *obj, const char *class_name, int r | |||
2519 | return EINA_FALSE; | 2519 | return EINA_FALSE; |
2520 | } | 2520 | } |
2521 | 2521 | ||
2522 | EAPI Eina_Stringshare * | ||
2523 | edje_edit_color_class_description_get(Evas_Object *obj, const char *class_name) | ||
2524 | { | ||
2525 | Eina_List *l; | ||
2526 | Edje_Color_Class *cc; | ||
2527 | |||
2528 | GET_ED_OR_RETURN(NULL); | ||
2529 | EINA_SAFETY_ON_NULL_RETURN_VAL(class_name, NULL); | ||
2530 | |||
2531 | if (!ed->file || !ed->file->color_classes) | ||
2532 | return NULL; | ||
2533 | EINA_LIST_FOREACH(ed->file->color_classes, l, cc) | ||
2534 | if (eina_streq(cc->name, class_name)) | ||
2535 | return cc->desc; | ||
2536 | return NULL; | ||
2537 | } | ||
2538 | |||
2539 | EAPI Eina_Bool | ||
2540 | edje_edit_color_class_description_set(Evas_Object *obj, const char *class_name, const char *desc) | ||
2541 | { | ||
2542 | Eina_List *l; | ||
2543 | Edje_Color_Class *cc; | ||
2544 | |||
2545 | GET_ED_OR_RETURN(EINA_FALSE); | ||
2546 | EINA_SAFETY_ON_NULL_RETURN_VAL(class_name, EINA_FALSE); | ||
2547 | |||
2548 | if (!ed->file || !ed->file->color_classes) | ||
2549 | return EINA_FALSE; | ||
2550 | EINA_LIST_FOREACH(ed->file->color_classes, l, cc) | ||
2551 | if (eina_streq(cc->name, class_name)) | ||
2552 | { | ||
2553 | eina_stringshare_replace(&cc->desc, desc); | ||
2554 | return EINA_TRUE; | ||
2555 | } | ||
2556 | return EINA_FALSE; | ||
2557 | } | ||
2558 | |||
2522 | EAPI Eina_Bool | 2559 | EAPI Eina_Bool |
2523 | edje_edit_color_class_add(Evas_Object *obj, const char *name) | 2560 | edje_edit_color_class_add(Evas_Object *obj, const char *name) |
2524 | { | 2561 | { |
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 3124151642..61b1de1aa3 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c | |||
@@ -1545,6 +1545,7 @@ _edje_file_free(Edje_File *edf) | |||
1545 | EINA_LIST_FREE(edf->color_classes, ecc) | 1545 | EINA_LIST_FREE(edf->color_classes, ecc) |
1546 | { | 1546 | { |
1547 | if (edf->free_strings && ecc->name) eina_stringshare_del(ecc->name); | 1547 | if (edf->free_strings && ecc->name) eina_stringshare_del(ecc->name); |
1548 | if (edf->free_strings) eina_stringshare_del(ecc->desc); | ||
1548 | free(ecc); | 1549 | free(ecc); |
1549 | } | 1550 | } |
1550 | 1551 | ||
diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index 6c80834607..7e633be1ac 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo | |||
@@ -2146,6 +2146,18 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File) | |||
2146 | @out int a3; /*@ Shadow Alpha value */ | 2146 | @out int a3; /*@ Shadow Alpha value */ |
2147 | } | 2147 | } |
2148 | } | 2148 | } |
2149 | color_class_description_get @const { | ||
2150 | /*@ | ||
2151 | @brief Gets the description of an object color class. | ||
2152 | |||
2153 | @return The description of the target color class or @c NULL if not found | ||
2154 | |||
2155 | This function gets the description of a color class in use by an object. */ | ||
2156 | return: const(char)*; | ||
2157 | params { | ||
2158 | @in const(char)* color_class; | ||
2159 | } | ||
2160 | } | ||
2149 | part_drag_step { | 2161 | part_drag_step { |
2150 | /*@ | 2162 | /*@ |
2151 | @brief Steps the dragable x,y steps. | 2163 | @brief Steps the dragable x,y steps. |
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 678421b19d..f76b655361 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h | |||
@@ -1867,6 +1867,7 @@ struct _Edje_Color_Class | |||
1867 | unsigned char r, g, b, a; | 1867 | unsigned char r, g, b, a; |
1868 | unsigned char r2, g2, b2, a2; | 1868 | unsigned char r2, g2, b2, a2; |
1869 | unsigned char r3, g3, b3, a3; | 1869 | unsigned char r3, g3, b3, a3; |
1870 | Eina_Stringshare *desc; | ||
1870 | }; | 1871 | }; |
1871 | 1872 | ||
1872 | struct _Edje_Text_Class | 1873 | struct _Edje_Text_Class |
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index 332b9586c9..8af4ceadde 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c | |||
@@ -66,6 +66,7 @@ _edje_color_class_free(void *data) | |||
66 | Edje_Color_Class *cc = data; | 66 | Edje_Color_Class *cc = data; |
67 | 67 | ||
68 | if (cc->name) eina_stringshare_del(cc->name); | 68 | if (cc->name) eina_stringshare_del(cc->name); |
69 | eina_stringshare_del(cc->desc); | ||
69 | free(cc); | 70 | free(cc); |
70 | } | 71 | } |
71 | 72 | ||
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index d0b71c6679..5187027d74 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c | |||
@@ -774,6 +774,13 @@ _edje_object_color_class_get(Eo *obj EINA_UNUSED, Edje *ed, const char *color_cl | |||
774 | return EINA_FALSE; | 774 | return EINA_FALSE; |
775 | } | 775 | } |
776 | 776 | ||
777 | EOLIAN Eina_Stringshare * | ||
778 | _edje_object_color_class_description_get(Eo *obj EINA_UNUSED, Edje *ed, const char *color_class) | ||
779 | { | ||
780 | Edje_Color_Class *cc = _edje_color_class_find(ed, color_class); | ||
781 | return cc ? cc->desc : NULL; | ||
782 | } | ||
783 | |||
777 | void | 784 | void |
778 | edje_object_color_class_del(Evas_Object *obj, const char *color_class) | 785 | edje_object_color_class_del(Evas_Object *obj, const char *color_class) |
779 | { | 786 | { |