diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/edje_cc.h | 2 | ||||
-rw-r--r-- | src/bin/edje_cc_handlers.c | 274 | ||||
-rw-r--r-- | src/bin/edje_cc_out.c | 34 | ||||
-rw-r--r-- | src/bin/edje_cc_parse.c | 2 | ||||
-rw-r--r-- | src/bin/edje_decc.c | 9 | ||||
-rw-r--r-- | src/bin/edje_player.c | 16 | ||||
-rw-r--r-- | src/lib/Edje.h | 193 | ||||
-rw-r--r-- | src/lib/Edje_Edit.h | 90 | ||||
-rw-r--r-- | src/lib/edje_cache.c | 1 | ||||
-rw-r--r-- | src/lib/edje_calc.c | 89 | ||||
-rw-r--r-- | src/lib/edje_data.c | 24 | ||||
-rw-r--r-- | src/lib/edje_edit.c | 472 | ||||
-rw-r--r-- | src/lib/edje_embryo.c | 30 | ||||
-rw-r--r-- | src/lib/edje_entry.c | 77 | ||||
-rw-r--r-- | src/lib/edje_load.c | 25 | ||||
-rw-r--r-- | src/lib/edje_lua.c | 2 | ||||
-rw-r--r-- | src/lib/edje_main.c | 14 | ||||
-rw-r--r-- | src/lib/edje_message_queue.c | 64 | ||||
-rw-r--r-- | src/lib/edje_private.h | 53 | ||||
-rw-r--r-- | src/lib/edje_program.c | 6 | ||||
-rw-r--r-- | src/lib/edje_script_only.c | 4 | ||||
-rw-r--r-- | src/lib/edje_util.c | 135 |
22 files changed, 1104 insertions, 512 deletions
diff --git a/src/bin/edje_cc.h b/src/bin/edje_cc.h index 828c6cd..2479b0f 100644 --- a/src/bin/edje_cc.h +++ b/src/bin/edje_cc.h @@ -105,7 +105,7 @@ void data_setup(void); void data_write(void); void data_queue_part_lookup(Edje_Part_Collection *pc, char *name, int *dest); void data_queue_program_lookup(Edje_Part_Collection *pc, char *name, int *dest); -void data_queue_image_lookup(char *name, int *dest); +void data_queue_image_lookup(char *name, int *dest, Eina_Bool *set); void data_queue_part_slave_lookup(int *master, int *slave); void data_queue_image_slave_lookup(int *master, int *slave); void data_queue_spectrum_lookup(char *name, int *dest); diff --git a/src/bin/edje_cc_handlers.c b/src/bin/edje_cc_handlers.c index c10d89e..3e7d9fd 100644 --- a/src/bin/edje_cc_handlers.c +++ b/src/bin/edje_cc_handlers.c @@ -73,6 +73,11 @@ static void st_externals_external(void); static void st_images_image(void); +static void ob_images_set(void); +static void st_images_set_name(void); +static void ob_images_set_image(void); +static void st_images_set_image_image(void); +static void st_images_set_image_size(void); static void st_fonts_font(void); @@ -261,6 +266,9 @@ New_Statement_Handler statement_handlers[] = { {"externals.external", st_externals_external}, {"images.image", st_images_image}, + {"images.set.name", st_images_set_name}, + {"images.set.image.image", st_images_set_image_image}, + {"images.set.image.size", st_images_set_image_size}, {"fonts.font", st_fonts_font}, {"data.item", st_data_item}, {"data.file", st_data_file}, @@ -276,7 +284,13 @@ New_Statement_Handler statement_handlers[] = {"spectra.spectrum.color", st_spectrum_color}, {"collections.externals.external", st_externals_external}, /* dup */ {"collections.image", st_images_image}, /* dup */ + {"collections.set.name", st_images_set_name}, /* dup */ + {"collections.set.image.image", st_images_set_image_image}, /* dup */ + {"collections.set.image.size", st_images_set_image_size}, /* dup */ {"collections.images.image", st_images_image}, /* dup */ + {"collections.images.set.name", st_images_set_name}, /* dup */ + {"collections.images.set.image.image", st_images_set_image_image}, /* dup */ + {"collections.images.set.image.size", st_images_set_image_size}, /* dup */ {"collections.font", st_fonts_font}, /* dup */ {"collections.fonts.font", st_fonts_font}, /* dup */ {"collections.styles.style.name", st_styles_style_name}, /* dup */ @@ -295,7 +309,13 @@ New_Statement_Handler statement_handlers[] = {"collections.group.data.item", st_collections_group_data_item}, {"collections.group.externals.external", st_externals_external}, /* dup */ {"collections.group.image", st_images_image}, /* dup */ + {"collections.group.set.name", st_images_set_name}, + {"collections.group.set.image.image", st_images_set_image_image}, + {"collections.group.set.image.size", st_images_set_image_size}, {"collections.group.images.image", st_images_image}, /* dup */ + {"collections.group.images.set.name", st_images_set_name}, + {"collections.group.images.set.image.image", st_images_set_image_image}, + {"collections.group.images.set.image.size", st_images_set_image_size}, {"collections.group.font", st_fonts_font}, /* dup */ {"collections.group.fonts.font", st_fonts_font}, /* dup */ {"collections.group.styles.style.name", st_styles_style_name}, /* dup */ @@ -306,7 +326,13 @@ New_Statement_Handler statement_handlers[] = {"collections.group.color_classes.color_class.color2", st_color_class_color2}, /* dup */ {"collections.group.color_classes.color_class.color3", st_color_class_color3}, /* dup */ {"collections.group.parts.image", st_images_image}, /* dup */ + {"collections.group.parts.set.name", st_images_set_name}, + {"collections.group.parts.set.image.image", st_images_set_image_image}, + {"collections.group.parts.set.image.size", st_images_set_image_size}, {"collections.group.parts.images.image", st_images_image}, /* dup */ + {"collections.group.parts.images.set.name", st_images_set_name}, + {"collections.group.parts.images.set.image.image", st_images_set_image_image}, + {"collections.group.parts.images.set.image.size", st_images_set_image_size}, {"collections.group.parts.font", st_fonts_font}, /* dup */ {"collections.group.parts.fonts.font", st_fonts_font}, /* dup */ {"collections.group.parts.styles.style.name", st_styles_style_name}, /* dup */ @@ -342,7 +368,13 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.select_mode", st_collections_group_parts_part_select_mode}, {"collections.group.parts.part.multiline", st_collections_group_parts_part_multiline}, {"collections.group.parts.part.image", st_images_image}, /* dup */ + {"collections.group.parts.part.set.name", st_images_set_name}, + {"collections.group.parts.part.set.image.image", st_images_set_image_image}, + {"collections.group.parts.part.set.image.size", st_images_set_image_size}, {"collections.group.parts.part.images.image", st_images_image}, /* dup */ + {"collections.group.parts.part.images.set.name", st_images_set_name}, + {"collections.group.parts.part.images.set.image.image", st_images_set_image_image}, + {"collections.group.parts.part.images.set.image.size", st_images_set_image_size}, {"collections.group.parts.part.font", st_fonts_font}, /* dup */ {"collections.group.parts.part.fonts.font", st_fonts_font}, /* dup */ {"collections.group.parts.part.styles.style.name", st_styles_style_name}, /* dup */ @@ -401,7 +433,13 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.image.normal", st_collections_group_parts_part_description_image_normal}, {"collections.group.parts.part.description.image.tween", st_collections_group_parts_part_description_image_tween}, {"collections.group.parts.part.description.image.image", st_images_image}, /* dup */ + {"collections.group.parts.part.description.image.set.name", st_images_set_name}, + {"collections.group.parts.part.description.image.set.image.image", st_images_set_image_image}, + {"collections.group.parts.part.description.image.set.image.size", st_images_set_image_size}, {"collections.group.parts.part.description.image.images.image", st_images_image}, /* dup */ + {"collections.group.parts.part.description.image.images.set.name", st_images_set_name}, + {"collections.group.parts.part.description.image.images.set.image.image", st_images_set_image_image}, + {"collections.group.parts.part.description.image.images.set.image.size", st_images_set_image_size}, {"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.border_scale", st_collections_group_parts_part_description_image_border_scale}, @@ -465,6 +503,9 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.params.bool", st_collections_group_parts_part_description_params_bool}, {"collections.group.parts.part.description.params.choice", st_collections_group_parts_part_description_params_choice}, {"collections.group.parts.part.description.images.image", st_images_image}, /* dup */ + {"collections.group.parts.part.description.images.set.name", st_images_set_name}, + {"collections.group.parts.part.description.images.set.image.image", st_images_set_image_image}, + {"collections.group.parts.part.description.images.set.image.size", st_images_set_image_size}, {"collections.group.parts.part.description.font", st_fonts_font}, /* dup */ {"collections.group.parts.part.description.fonts.font", st_fonts_font}, /* dup */ {"collections.group.parts.part.description.styles.style.name", st_styles_style_name}, /* dup */ @@ -475,7 +516,13 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.color_classes.color_class.color2", st_color_class_color2}, /* dup */ {"collections.group.parts.part.description.color_classes.color_class.color3", st_color_class_color3}, /* dup */ {"collections.group.parts.part.description.programs.image", st_images_image}, /* dup */ + {"collections.group.parts.part.description.programs.set.name", st_images_set_name}, + {"collections.group.parts.part.description.programs.set.image.image", st_images_set_image_image}, + {"collections.group.parts.part.description.programs.set.image.size", st_images_set_image_size}, {"collections.group.parts.part.description.programs.images.image", st_images_image}, /* dup */ + {"collections.group.parts.part.description.programs.images.set.name", st_images_set_name}, + {"collections.group.parts.part.description.programs.images.set.image.image", st_images_set_image_image}, + {"collections.group.parts.part.description.programs.images.set.image.size", st_images_set_image_size}, {"collections.group.parts.part.description.programs.font", st_fonts_font}, /* dup */ {"collections.group.parts.part.description.programs.fonts.font", st_fonts_font}, /* dup */ {"collections.group.parts.part.description.programs.program.name", st_collections_group_programs_program_name}, /* dup */ @@ -497,7 +544,13 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.description.program.after", st_collections_group_programs_program_after}, /* dup */ {"collections.group.parts.part.description.program.api", st_collections_group_programs_program_api}, /* dup */ {"collections.group.parts.part.programs.image", st_images_image}, /* dup */ + {"collections.group.parts.part.programs.set.name", st_images_set_name}, + {"collections.group.parts.part.programs.set.image.image", st_images_set_image_image}, + {"collections.group.parts.part.programs.set.image.size", st_images_set_image_size}, {"collections.group.parts.part.programs.images.image", st_images_image}, /* dup */ + {"collections.group.parts.part.programs.images.set.name", st_images_set_name}, + {"collections.group.parts.part.programs.images.set.image.image", st_images_set_image_image}, + {"collections.group.parts.part.programs.images.set.image.size", st_images_set_image_size}, {"collections.group.parts.part.programs.font", st_fonts_font}, /* dup */ {"collections.group.parts.part.programs.fonts.font", st_fonts_font}, /* dup */ {"collections.group.parts.part.programs.program.name", st_collections_group_programs_program_name}, /* dup */ @@ -519,7 +572,13 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.program.after", st_collections_group_programs_program_after}, /* dup */ {"collections.group.parts.part.program.api", st_collections_group_programs_program_api}, /* dup */ {"collections.group.parts.programs.image", st_images_image}, /* dup */ + {"collections.group.parts.programs.set.name", st_images_set_name}, + {"collections.group.parts.programs.set.image.image", st_images_set_image_image}, + {"collections.group.parts.programs.set.image.size", st_images_set_image_size}, {"collections.group.parts.programs.images.image", st_images_image}, /* dup */ + {"collections.group.parts.programs.images.set.name", st_images_set_name}, + {"collections.group.parts.programs.images.set.image.image", st_images_set_image_image}, + {"collections.group.parts.programs.images.set.image.size", st_images_set_image_size}, {"collections.group.parts.programs.font", st_fonts_font}, /* dup */ {"collections.group.parts.programs.fonts.font", st_fonts_font}, /* dup */ {"collections.group.parts.programs.program.name", st_collections_group_programs_program_name}, /* dup */ @@ -562,7 +621,13 @@ New_Statement_Handler statement_handlers[] = {"collections.group.programs.program.after", st_collections_group_programs_program_after}, {"collections.group.programs.program.api", st_collections_group_programs_program_api}, {"collections.group.programs.image", st_images_image}, /* dup */ + {"collections.group.programs.set.name", st_images_set_name}, + {"collections.group.programs.set.image.image", st_images_set_image_image}, + {"collections.group.programs.set.image.size", st_images_set_image_size}, {"collections.group.programs.images.image", st_images_image}, /* dup */ + {"collections.group.programs.images.set.name", st_images_set_name}, + {"collections.group.programs.images.set.image.image", st_images_set_image_image}, + {"collections.group.programs.images.set.image.size", st_images_set_image_size}, {"collections.group.programs.font", st_fonts_font}, /* dup */ {"collections.group.programs.fonts.font", st_fonts_font} /* dup */ }; @@ -571,6 +636,8 @@ New_Object_Handler object_handlers[] = { {"externals", NULL}, {"images", NULL}, + {"images.set", ob_images_set}, + {"images.set.image", ob_images_set_image}, {"fonts", NULL}, {"data", NULL}, {"styles", NULL}, @@ -581,7 +648,11 @@ New_Object_Handler object_handlers[] = {"spectra.spectrum", ob_spectrum}, {"collections", ob_collections}, {"collections.externals", NULL}, /* dup */ + {"collections.set", ob_images_set}, /* dup */ + {"collections.set.image", ob_images_set_image}, /* dup */ {"collections.images", NULL}, /* dup */ + {"collections.images.set", ob_images_set}, /* dup */ + {"collections.images.set.image", ob_images_set_image}, /* dup */ {"collections.fonts", NULL}, /* dup */ {"collections.styles", NULL}, /* dup */ {"collections.styles.style", ob_styles_style}, /* dup */ @@ -592,14 +663,22 @@ New_Object_Handler object_handlers[] = {"collections.group.script", ob_collections_group_script}, {"collections.group.lua_script", ob_collections_group_lua_script}, {"collections.group.externals", NULL}, /* dup */ + {"collections.group.set", ob_images_set}, /* dup */ + {"collections.group.set.image", ob_images_set_image}, /* dup */ {"collections.group.images", NULL}, /* dup */ + {"collections.group.images.set", ob_images_set}, /* dup */ + {"collections.group.images.set.image", ob_images_set_image}, /* dup */ {"collections.group.fonts", NULL}, /* dup */ {"collections.group.styles", NULL}, /* dup */ {"collections.group.styles.style", ob_styles_style}, /* dup */ {"collections.group.color_classes", NULL}, /* dup */ {"collections.group.color_classes.color_class", ob_color_class}, /* dup */ {"collections.group.parts", NULL}, + {"collections.group.parts.set", ob_images_set}, /* dup */ + {"collections.group.parts.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.images", NULL}, /* dup */ + {"collections.group.parts.images.set", ob_images_set}, /* dup */ + {"collections.group.parts.images.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.fonts", NULL}, /* dup */ {"collections.group.parts.styles", NULL}, /* dup */ {"collections.group.parts.styles.style", ob_styles_style}, /* dup */ @@ -607,7 +686,11 @@ New_Object_Handler object_handlers[] = {"collections.group.parts.color_classes.color_class", ob_color_class}, /* dup */ {"collections.group.parts.part", ob_collections_group_parts_part}, {"collections.group.parts.part.dragable", NULL}, + {"collections.group.parts.part.set", ob_images_set}, /* dup */ + {"collections.group.parts.part.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.part.images", NULL}, /* dup */ + {"collections.group.parts.part.images.set", ob_images_set}, /* dup */ + {"collections.group.parts.part.images.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.part.fonts", NULL}, /* dup */ {"collections.group.parts.part.styles", NULL}, /* dup */ {"collections.group.parts.part.styles.style", ob_styles_style}, /* dup */ @@ -623,13 +706,19 @@ New_Object_Handler object_handlers[] = {"collections.group.parts.part.description.rel1", NULL}, {"collections.group.parts.part.description.rel2", NULL}, {"collections.group.parts.part.description.image", NULL}, /* dup */ + {"collections.group.parts.part.description.image.set", ob_images_set}, /* dup */ + {"collections.group.parts.part.description.image.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.part.description.image.images", NULL}, /* dup */ + {"collections.group.parts.part.description.image.images.set", ob_images_set}, /* dup */ + {"collections.group.parts.part.description.image.images.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.part.description.fill", NULL}, {"collections.group.parts.part.description.fill.origin", NULL}, {"collections.group.parts.part.description.fill.size", NULL}, {"collections.group.parts.part.description.text", NULL}, {"collections.group.parts.part.description.text.fonts", NULL}, /* dup */ {"collections.group.parts.part.description.images", NULL}, /* dup */ + {"collections.group.parts.part.description.images.set", ob_images_set}, /* dup */ + {"collections.group.parts.part.description.images.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.part.description.fonts", NULL}, /* dup */ {"collections.group.parts.part.description.styles", NULL}, /* dup */ {"collections.group.parts.part.description.styles.style", ob_styles_style}, /* dup */ @@ -648,7 +737,11 @@ New_Object_Handler object_handlers[] = {"collections.group.parts.part.description.program.script", ob_collections_group_programs_program_script}, /* dup */ {"collections.group.parts.part.description.program.lua_script", ob_collections_group_programs_program_lua_script}, /* dup */ {"collections.group.parts.part.description.programs", NULL}, /* dup */ + {"collections.group.parts.part.description.programs.set", ob_images_set}, /* dup */ + {"collections.group.parts.part.description.programs.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.part.description.programs.images", NULL}, /* dup */ + {"collections.group.parts.part.description.programs.images.set", ob_images_set}, + {"collections.group.parts.part.description.programs.images.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.part.description.programs.fonts", NULL}, /* dup */ {"collections.group.parts.part.description.programs.program", ob_collections_group_programs_program}, /* dup */ {"collections.group.parts.part.description.programs.program.script", ob_collections_group_programs_program_script}, /* dup */ @@ -659,7 +752,11 @@ New_Object_Handler object_handlers[] = {"collections.group.parts.part.program.script", ob_collections_group_programs_program_script}, /* dup */ {"collections.group.parts.part.program.lua_script", ob_collections_group_programs_program_lua_script}, /* dup */ {"collections.group.parts.part.programs", NULL}, /* dup */ + {"collections.group.parts.part.programs.set", ob_images_set}, /* dup */ + {"collections.group.parts.part.programs.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.part.programs.images", NULL}, /* dup */ + {"collections.group.parts.part.programs.images.set", ob_images_set}, /* dup */ + {"collections.group.parts.part.programs.images.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.part.programs.fonts", NULL}, /* dup */ {"collections.group.parts.part.programs.program", ob_collections_group_programs_program}, /* dup */ {"collections.group.parts.part.programs.program.script", ob_collections_group_programs_program_script}, /* dup */ @@ -670,7 +767,11 @@ New_Object_Handler object_handlers[] = {"collections.group.parts.program.script", ob_collections_group_programs_program_script}, /* dup */ {"collections.group.parts.program.lua_script", ob_collections_group_programs_program_lua_script}, /* dup */ {"collections.group.parts.programs", NULL}, /* dup */ + {"collections.group.parts.programs.set", ob_images_set}, /* dup */ + {"collections.group.parts.programs.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.programs.images", NULL}, /* dup */ + {"collections.group.parts.programs.images.set", ob_images_set}, /* dup */ + {"collections.group.parts.programs.images.set.image", ob_images_set_image}, /* dup */ {"collections.group.parts.programs.fonts", NULL}, /* dup */ {"collections.group.parts.programs.program", ob_collections_group_programs_program}, /* dup */ {"collections.group.parts.programs.program.script", ob_collections_group_programs_program_script}, /* dup */ @@ -681,7 +782,11 @@ New_Object_Handler object_handlers[] = {"collections.group.program.script", ob_collections_group_programs_program_script}, /* dup */ {"collections.group.program.lua_script", ob_collections_group_programs_program_lua_script}, /* dup */ {"collections.group.programs", NULL}, + {"collections.group.programs.set", ob_images_set}, /* dup */ + {"collections.group.programs.set.image", ob_images_set_image}, /* dup */ {"collections.group.programs.images", NULL}, /* dup */ + {"collections.group.programs.images.set", ob_images_set}, /* dup */ + {"collections.group.programs.images.set.image", ob_images_set_image}, /* dup */ {"collections.group.programs.fonts", NULL}, /* dup */ {"collections.group.programs.program", ob_collections_group_programs_program}, {"collections.group.programs.program.script", ob_collections_group_programs_program_script}, @@ -778,14 +883,33 @@ st_externals_external(void) images { image: "filename1.ext" COMP; image: "filename2.ext" LOSSY 99; + set { + name: "image_name_used"; + image { + image: "filename3.ext" LOSSY 90; + size: 201 201 500 500; + } + image { + image: "filename4.ext" COMP; + size: 51 51 200 200; + } + image { + image: "filename5.ext" COMP; + size: 11 11 50 50; + } + image { + image: "filename6.ext" RAW; + size: 0 0 10 10; + } + } .. } @description The "images" block is used to list each image file that will be used in the theme along with its compression method (if any). - Besides the domcument's root, additional "images" blocks can be + Besides the document's root, additional "images" blocks can be included inside other blocks, normally "collections", "group" and - "part", easing mantienance of the file list when the theme is split + "part", easing maintenance of the file list when the theme is split among multiple files. @endblock @@ -868,6 +992,146 @@ st_images_image(void) @page edcref @block + set + @context + set { + name: "image_name_used"; + image { + image: "filename3.ext" LOSSY 90; + size: 201 201 500 500; + } + image { + image: "filename4.ext" COMP; + size: 51 51 200 200; + } + image { + image: "filename5.ext" COMP; + size: 11 11 50 50; + } + image { + image: "filename6.ext" RAW; + size: 0 0 10 10; + } + } + @description + The "set" block is used to define an image with different content depending on their size. + Besides the document's root, additional "set" blocks can be + included inside other blocks, normally "collections", "group" and + "part", easing maintenance of the file list when the theme is split + among multiple files. + @endblock + */ +static void +ob_images_set(void) +{ + Edje_Image_Directory_Set *set; + + if (!edje_file->image_dir) + edje_file->image_dir = mem_alloc(SZ(Edje_Image_Directory)); + set = mem_alloc(SZ(Edje_Image_Directory_Set)); + set->id = eina_list_count(edje_file->image_dir->sets); + edje_file->image_dir->sets = eina_list_append(edje_file->image_dir->sets, set); +} + +/** + @page edcref + + @property + name + @parameters + [image name] + @effect + Define the name that refer to this image description. + @endproperty +*/ +static void +st_images_set_name(void) +{ + Edje_Image_Directory_Set *set; + + check_arg_count(1); + + set = eina_list_data_get(eina_list_last(edje_file->image_dir->sets)); + set->name = parse_str(0); +} + +static void +ob_images_set_image(void) +{ + Edje_Image_Directory_Set_Entry *entry; + Edje_Image_Directory_Set *set; + + set = eina_list_data_get(eina_list_last(edje_file->image_dir->sets)); + + entry = mem_alloc(SZ(Edje_Image_Directory_Set_Entry)); + + set->entries = eina_list_append(set->entries, entry); +} + +static void +st_images_set_image_image(void) +{ + Edje_Image_Directory_Set_Entry *entry; + Edje_Image_Directory_Set *set; + Edje_Image_Directory_Entry *img; + Eina_List *l; + + set = eina_list_data_get(eina_list_last(edje_file->image_dir->sets)); + entry = eina_list_data_get(eina_list_last(set->entries)); + + /* Add the image to the global pool with the same syntax. */ + st_images_image(); + + entry->name = parse_str(0); + + EINA_LIST_FOREACH(edje_file->image_dir->entries, l, img) + if (!strcmp(img->entry, entry->name)) + { + entry->id = img->id; + return; + } +} + +/** + @page edcref + + @property + size + @parameters + [minw minh maxw mawh] + @effect + Define the minimal and maximal size that will select the specified image. + @endproperty +*/ +static void +st_images_set_image_size(void) +{ + Edje_Image_Directory_Set_Entry *entry; + Edje_Image_Directory_Set *set; + + set = eina_list_data_get(eina_list_last(edje_file->image_dir->sets)); + entry = eina_list_data_get(eina_list_last(set->entries)); + + entry->size.min.w = parse_int(0); + entry->size.min.h = parse_int(1); + entry->size.max.w = parse_int(2); + entry->size.max.h = parse_int(3); + + if (entry->size.min.w > entry->size.max.w + || entry->size.min.h > entry->size.max.h) + { + ERR("%s: Error. parse error %s:%i. Image min and max size are not in the right order ([%i, %i] < [%i, %i])", + progname, file_in, line - 1, + entry->size.min.w, entry->size.min.h, + entry->size.max.w, entry->size.max.h); + exit(-1); + } +} + +/** + @page edcref + + @block fonts @context fonts { @@ -2606,7 +2870,7 @@ static void ob_collections_group_parts_part_box_items_item(void) item->weight.y = FROM_DOUBLE(0.0); item->aspect.w = 0; item->aspect.h = 0; - item->aspect.mode = EDJE_ASPECT_PREFER_NONE; + item->aspect.mode = EDJE_ASPECT_CONTROL_NONE; item->options = NULL; item->col = -1; item->row = -1; @@ -4024,7 +4288,7 @@ st_collections_group_parts_part_description_image_normal(void) char *name; name = parse_str(0); - data_queue_image_lookup(name, &(ed->image.id)); + data_queue_image_lookup(name, &(ed->image.id), &(ed->image.set)); free(name); } } @@ -4070,7 +4334,7 @@ st_collections_group_parts_part_description_image_tween(void) iid = mem_alloc(SZ(Edje_Part_Image_Id)); ed->image.tween_list = eina_list_append(ed->image.tween_list, iid); name = parse_str(0); - data_queue_image_lookup(name, &(iid->id)); + data_queue_image_lookup(name, &(iid->id), &(iid->set)); free(name); } } diff --git a/src/bin/edje_cc_out.c b/src/bin/edje_cc_out.c index b7b8cbc..ec19d58 100644 --- a/src/bin/edje_cc_out.c +++ b/src/bin/edje_cc_out.c @@ -40,7 +40,7 @@ typedef struct _External_Lookup External_Lookup; typedef struct _Part_Lookup Part_Lookup; typedef struct _Program_Lookup Program_Lookup; typedef struct _Group_Lookup Group_Lookup; -typedef struct _String_Lookup Image_Lookup; +typedef struct _Image_Lookup Image_Lookup; typedef struct _String_Lookup Spectrum_Lookup; typedef struct _Slave_Lookup Slave_Lookup; typedef struct _Code_Lookup Code_Lookup; @@ -76,6 +76,13 @@ struct _String_Lookup int *dest; }; +struct _Image_Lookup +{ + char *name; + int *dest; + Eina_Bool *set; +}; + struct _Slave_Lookup { int *master; @@ -87,6 +94,7 @@ struct _Code_Lookup char *ptr; int len; int val; + Eina_Bool set; }; static void data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void (*func)(Edje_Part_Collection *pc, char *name, char *ptr, int len)); @@ -208,6 +216,7 @@ check_part (Edje_Part_Collection *pc, Edje_Part *ep, Eet_File *ef) Eina_List *l; Edje_Part_Description *data; + /* FIXME: check image set and sort them. */ if (!epd) error_and_abort(ef, "Collection %i: default description missing " "for part \"%s\"\n", pc->id, ep->name); @@ -1160,7 +1169,7 @@ data_queue_program_lookup(Edje_Part_Collection *pc, char *name, int *dest) } void -data_queue_image_lookup(char *name, int *dest) +data_queue_image_lookup(char *name, int *dest, Eina_Bool *set) { Image_Lookup *il; @@ -1168,6 +1177,7 @@ data_queue_image_lookup(char *name, int *dest) image_lookups = eina_list_append(image_lookups, il); il->name = mem_strdup(name); il->dest = dest; + il->set = set; } void @@ -1328,9 +1338,26 @@ data_process_lookups(void) *(il->dest) = -de->id - 1; else *(il->dest) = de->id; + *(il->set) = EINA_FALSE; break; } } + + if (!l) + { + Edje_Image_Directory_Set *set; + + EINA_LIST_FOREACH(edje_file->image_dir->sets, l, set) + { + if ((set->name) && (!strcmp(set->name, il->name))) + { + handle_slave_lookup(image_slave_lookups, il->dest, set->id); + *(il->dest) = set->id; + *(il->set) = EINA_TRUE; + break; + } + } + } } if (!l) @@ -1547,7 +1574,7 @@ _data_queue_image_pc_lookup(Edje_Part_Collection *pc __UNUSED__, char *name, cha cl->ptr = ptr; cl->len = len; - data_queue_image_lookup(name, &(cl->val)); + data_queue_image_lookup(name, &(cl->val), &(cl->set)); code_lookups = eina_list_append(code_lookups, cl); } @@ -1601,6 +1628,7 @@ data_process_script_lookups(void) char buf[12]; int n; + /* FIXME !! Handle set in program */ n = eina_convert_itoa(cl->val, buf); if (n > cl->len) { diff --git a/src/bin/edje_cc_parse.c b/src/bin/edje_cc_parse.c index 94909d1..24196cf 100644 --- a/src/bin/edje_cc_parse.c +++ b/src/bin/edje_cc_parse.c @@ -740,7 +740,7 @@ compile(void) snprintf(buf, sizeof(buf), "cat %s | cpp -I%s %s > %s", file_in, inc, def, tmpn); ret = system(buf); -#if defined (__MacOSX__) || ( defined (__MACH__) && defined (__APPLE__)) +#if defined (__MacOSX__) || ( defined (__MACH__) && defined (__APPLE__) ) || defined (__OpenBSD__) if (ret == 0) { static char tmpn2[4096]; diff --git a/src/bin/edje_decc.c b/src/bin/edje_decc.c index 7a1f7a8..387a873 100644 --- a/src/bin/edje_decc.c +++ b/src/bin/edje_decc.c @@ -47,6 +47,10 @@ main_help(void) ("Usage:\n" "\t%s input_file.edj [-main-out file.edc] [-no-build-sh] [-current-dir]\n" "\n" + " -main-out\tCreate a symbolic link to the main edc \n" + " -no-build-sh\tDon't output build.sh \n" + " -current-dir\tOutput to current directory \n" + "\n" ,progname); } @@ -72,6 +76,11 @@ main(int argc, char **argv) progname = argv[0]; for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-h")) + { + main_help(); + exit(0); + } if (!file_in) file_in = argv[i]; else if ((!strcmp(argv[i], "-main-out")) && (i < (argc - 1))) diff --git a/src/bin/edje_player.c b/src/bin/edje_player.c index 8ff86ab..f08c774 100644 --- a/src/bin/edje_player.c +++ b/src/bin/edje_player.c @@ -2,12 +2,6 @@ #include <config.h> #endif -#include <Edje.h> -#include <Ecore_Evas.h> -#include <Ecore.h> -#include <Ecore_Getopt.h> -#include <Evas.h> - #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -16,6 +10,16 @@ #include <fcntl.h> #include <ctype.h> +#ifdef HAVE_EVIL +# include <Evil.h> +#endif + +#include <Evas.h> +#include <Ecore.h> +#include <Ecore_Getopt.h> +#include <Ecore_Evas.h> +#include <Edje.h> + struct opts { char *file; char *group; diff --git a/src/lib/Edje.h b/src/lib/Edje.h index bdd4bf8..809bf49 100644 --- a/src/lib/Edje.h +++ b/src/lib/Edje.h @@ -3,6 +3,8 @@ #include <stdint.h> #include <math.h> +#include <float.h> +#include <limits.h> #include <Evas.h> @@ -32,6 +34,23 @@ # endif #endif +#ifdef __cplusplus +extern "C" { +#endif + +#define EDJE_VERSION_MAJOR 0 +#define EDJE_VERSION_MINOR 9 + + typedef struct _Edje_Version + { + int major; + int minor; + int micro; + int revision; + } Edje_Version; + + EAPI extern Edje_Version *edje_version; + /** * @file Edje.h * @brief Edje Graphical Design Library @@ -266,8 +285,8 @@ struct _Edje_External_Param }; typedef struct _Edje_External_Param Edje_External_Param; -#define EDJE_EXTERNAL_INT_UNSET 0xffffffff -#define EDJE_EXTERNAL_DOUBLE_UNSET HUGE_VAL +#define EDJE_EXTERNAL_INT_UNSET INT_MAX +#define EDJE_EXTERNAL_DOUBLE_UNSET DBL_MAX struct _Edje_External_Param_Info { @@ -358,7 +377,6 @@ struct _Edje_External_Type * - #EDJE_EXTERNAL_TYPE_ABI_VERSION to declare. * - edje_external_type_abi_version_get() to check. */ - const char *module; const char *module_name; Evas_Object *(*add) (void *data, Evas *evas, Evas_Object *parent, const Eina_List *params, const char *part_name); /**< creates the object to be used by Edje as the part */ @@ -383,7 +401,6 @@ struct _Edje_External_Type }; typedef struct _Edje_External_Type Edje_External_Type; - struct _Edje_External_Type_Info { const char *name; @@ -391,16 +408,10 @@ struct _Edje_External_Type_Info }; typedef struct _Edje_External_Type_Info Edje_External_Type_Info; - - -typedef void (*Edje_Signal_Cb) (void *data, Evas_Object *obj, const char *emission, const char *source); -typedef void (*Edje_Text_Change_Cb) (void *data, Evas_Object *obj, const char *part); +typedef void (*Edje_Signal_Cb) (void *data, Evas_Object *obj, const char *emission, const char *source); +typedef void (*Edje_Text_Change_Cb) (void *data, Evas_Object *obj, const char *part); typedef void (*Edje_Message_Handler_Cb) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg); -#ifdef __cplusplus -extern "C" { -#endif - /* edje_main.c */ EAPI int edje_init (void); EAPI int edje_shutdown (void); @@ -433,17 +444,17 @@ extern "C" { /* edje_util.c */ - EAPI Eina_Bool edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3); - EAPI Eina_Bool edje_color_class_get(const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3); - EAPI void edje_color_class_del(const char *color_class); - EAPI Eina_List * edje_color_class_list(void); - EAPI Eina_Bool edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size size); - EAPI void edje_text_class_del(const char *text_class); - EAPI Eina_List * edje_text_class_list(void); + EAPI Eina_Bool edje_color_class_set (const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3); + EAPI Eina_Bool edje_color_class_get (const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3); + EAPI void edje_color_class_del (const char *color_class); + EAPI Eina_List *edje_color_class_list (void); + EAPI Eina_Bool edje_text_class_set (const char *text_class, const char *font, Evas_Font_Size size); + EAPI void edje_text_class_del (const char *text_class); + EAPI Eina_List *edje_text_class_list (void); EAPI void edje_extern_object_min_size_set (Evas_Object *obj, Evas_Coord minw, Evas_Coord minh); EAPI void edje_extern_object_max_size_set (Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh); - EAPI void edje_extern_object_aspect_set(Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah); - EAPI void edje_box_layout_register(const char *name, Evas_Object_Box_Layout func, void *(*layout_data_get)(void *), void (*layout_data_free)(void *), void (*free_data)(void *), void *data); + EAPI void edje_extern_object_aspect_set (Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah); + EAPI void edje_box_layout_register (const char *name, Evas_Object_Box_Layout func, void *(*layout_data_get)(void *), void (*layout_data_free)(void *), void (*free_data)(void *), void *data); /* edje_smart.c */ EAPI Evas_Object *edje_object_add (Evas *evas); @@ -470,32 +481,35 @@ extern "C" { EAPI Eina_Bool edje_object_animation_get (const Evas_Object *obj); /* edje_util.c */ - EAPI int edje_object_freeze (Evas_Object *obj); - EAPI int edje_object_thaw (Evas_Object *obj); - EAPI Eina_Bool edje_object_color_class_set (Evas_Object *obj, const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3); - EAPI Eina_Bool edje_object_color_class_get (const Evas_Object *o, const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3); - EAPI void edje_object_color_class_del (Evas_Object *obj, const char *color_class); - EAPI Eina_Bool edje_object_text_class_set (Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size); - EAPI void edje_object_size_min_get (const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); - EAPI void edje_object_size_max_get (const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh); - EAPI void edje_object_calc_force (Evas_Object *obj); - EAPI void edje_object_size_min_calc (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); - EAPI Eina_Bool edje_object_parts_extends_calc(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + EAPI int edje_object_freeze (Evas_Object *obj); + EAPI int edje_object_thaw (Evas_Object *obj); + EAPI Eina_Bool edje_object_color_class_set (Evas_Object *obj, const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3); + EAPI Eina_Bool edje_object_color_class_get (const Evas_Object *o, const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3); + EAPI void edje_object_color_class_del (Evas_Object *obj, const char *color_class); + EAPI Eina_Bool edje_object_text_class_set (Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size); + EAPI void edje_object_size_min_get (const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); + EAPI void edje_object_size_max_get (const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh); + EAPI void edje_object_calc_force (Evas_Object *obj); + EAPI void edje_object_size_min_calc (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); + EAPI Eina_Bool edje_object_parts_extends_calc (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); EAPI void edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh); - EAPI Eina_Bool edje_object_part_exists (const Evas_Object *obj, const char *part); - EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part); - EAPI Eina_Bool edje_object_part_geometry_get (const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); - EAPI void edje_object_text_change_cb_set (Evas_Object *obj, Edje_Text_Change_Cb func, void *data); - EAPI Eina_Bool edje_object_part_text_set (Evas_Object *obj, const char *part, const char *text); - EAPI const char *edje_object_part_text_get (const Evas_Object *obj, const char *part); - EAPI Eina_Bool edje_object_part_text_unescaped_set(Evas_Object *obj, const char *part, const char *text_to_escape); - EAPI char *edje_object_part_text_unescaped_get(const Evas_Object *obj, const char *part); + EAPI Eina_Bool edje_object_part_exists (const Evas_Object *obj, const char *part); + EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part); + EAPI Eina_Bool edje_object_part_geometry_get (const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + + EAPI void edje_object_item_provider_set (Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *obj, const char *part, const char *item), void *data); + + EAPI void edje_object_text_change_cb_set (Evas_Object *obj, Edje_Text_Change_Cb func, void *data); + + EAPI Eina_Bool edje_object_part_text_set (Evas_Object *obj, const char *part, const char *text); + EAPI const char *edje_object_part_text_get (const Evas_Object *obj, const char *part); + EAPI Eina_Bool edje_object_part_text_unescaped_set (Evas_Object *obj, const char *part, const char *text_to_escape); + EAPI char *edje_object_part_text_unescaped_get (const Evas_Object *obj, const char *part); EAPI const char *edje_object_part_text_selection_get (const Evas_Object *obj, const char *part); EAPI void edje_object_part_text_select_none (const Evas_Object *obj, const char *part); EAPI void edje_object_part_text_select_all (const Evas_Object *obj, const char *part); EAPI void edje_object_part_text_insert (Evas_Object *obj, const char *part, const char *text); - EAPI void edje_object_item_provider_set (Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *obj, const char *part, const char *item), void *data); EAPI const Eina_List *edje_object_part_text_anchor_list_get (const Evas_Object *obj, const char *part); EAPI const Eina_List *edje_object_part_text_anchor_geometry_get (const Evas_Object *obj, const char *part, const char *anchor); EAPI const Eina_List *edje_object_part_text_item_list_get (const Evas_Object *obj, const char *part); @@ -506,19 +520,22 @@ extern "C" { EAPI void edje_object_part_text_select_begin (const Evas_Object *obj, const char *part); EAPI void edje_object_part_text_select_extend (const Evas_Object *obj, const char *part); - EAPI Eina_Bool edje_object_part_text_cursor_next(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_prev(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_up(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_down(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_begin_set(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_end_set(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_copy(const Evas_Object *obj, const char *part, Edje_Cursor src, Edje_Cursor dst); - EAPI void edje_object_part_text_cursor_line_begin_set(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_line_end_set(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_is_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI Eina_Bool edje_object_part_text_cursor_next (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI Eina_Bool edje_object_part_text_cursor_prev (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI Eina_Bool edje_object_part_text_cursor_up (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI Eina_Bool edje_object_part_text_cursor_down (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI void edje_object_part_text_cursor_begin_set (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI void edje_object_part_text_cursor_end_set (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI void edje_object_part_text_cursor_copy (const Evas_Object *obj, const char *part, Edje_Cursor src, Edje_Cursor dst); + EAPI void edje_object_part_text_cursor_line_begin_set (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI void edje_object_part_text_cursor_line_end_set (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI Eina_Bool edje_object_part_text_cursor_is_format_get (const Evas_Object *obj, const char *part, Edje_Cursor cur); EAPI Eina_Bool edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI const char *edje_object_part_text_cursor_content_get(const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI const char *edje_object_part_text_cursor_content_get (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI void edje_object_text_insert_filter_callback_add (Evas_Object *obj, const char *part, void (*func) (void *data, Evas_Object *obj, const char *part, char **text), const void *data); + EAPI void edje_object_text_insert_filter_callback_del (Evas_Object *obj, const char *part, void (*func) (void *data, Evas_Object *obj, const char *part, char **text), const void *data); + EAPI Eina_Bool edje_object_part_swallow (Evas_Object *obj, const char *part, Evas_Object *obj_swallow); EAPI void edje_object_part_unswallow (Evas_Object *obj, Evas_Object *obj_swallow); EAPI Evas_Object *edje_object_part_swallow_get (const Evas_Object *obj, const char *part); @@ -535,54 +552,54 @@ extern "C" { EAPI Eina_Bool edje_object_part_drag_step (Evas_Object *obj, const char *part, double dx, double dy); EAPI Eina_Bool edje_object_part_drag_page (Evas_Object *obj, const char *part, double dx, double dy); - EAPI Evas_Object *edje_object_part_external_object_get(const Evas_Object *obj, const char *part); - EAPI Eina_Bool edje_object_part_external_param_set(Evas_Object *obj, const char *part, const Edje_External_Param *param); - EAPI Eina_Bool edje_object_part_external_param_get(const Evas_Object *obj, const char *part, Edje_External_Param *param); - EAPI Edje_External_Param_Type edje_object_part_external_param_type_get(const Evas_Object *obj, const char *part, const char *param); - - EAPI Eina_Bool edje_object_part_box_append (Evas_Object *obj, const char *part, Evas_Object *child); - EAPI Eina_Bool edje_object_part_box_prepend (Evas_Object *obj, const char *part, Evas_Object *child); - EAPI Eina_Bool edje_object_part_box_insert_before (Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference); - EAPI Eina_Bool edje_object_part_box_insert_at (Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos); - EAPI Evas_Object *edje_object_part_box_remove (Evas_Object *obj, const char *part, Evas_Object *child); - EAPI Evas_Object *edje_object_part_box_remove_at (Evas_Object *obj, const char *part, unsigned int pos); - EAPI Eina_Bool edje_object_part_box_remove_all (Evas_Object *obj, const char *part, Eina_Bool clear); - EAPI Evas_Object *edje_object_part_table_child_get(Evas_Object *obj, const char *part, unsigned int col, unsigned int row); - EAPI Eina_Bool edje_object_part_table_pack (Evas_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan); - EAPI Eina_Bool edje_object_part_table_unpack (Evas_Object *obj, const char *part, Evas_Object *child_obj); + EAPI Evas_Object *edje_object_part_external_object_get (const Evas_Object *obj, const char *part); + EAPI Eina_Bool edje_object_part_external_param_set (Evas_Object *obj, const char *part, const Edje_External_Param *param); + EAPI Eina_Bool edje_object_part_external_param_get (const Evas_Object *obj, const char *part, Edje_External_Param *param); + EAPI Edje_External_Param_Type edje_object_part_external_param_type_get (const Evas_Object *obj, const char *part, const char *param); + + EAPI Eina_Bool edje_object_part_box_append (Evas_Object *obj, const char *part, Evas_Object *child); + EAPI Eina_Bool edje_object_part_box_prepend (Evas_Object *obj, const char *part, Evas_Object *child); + EAPI Eina_Bool edje_object_part_box_insert_before (Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference); + EAPI Eina_Bool edje_object_part_box_insert_at (Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos); + EAPI Evas_Object *edje_object_part_box_remove (Evas_Object *obj, const char *part, Evas_Object *child); + EAPI Evas_Object *edje_object_part_box_remove_at (Evas_Object *obj, const char *part, unsigned int pos); + EAPI Eina_Bool edje_object_part_box_remove_all (Evas_Object *obj, const char *part, Eina_Bool clear); + EAPI Evas_Object *edje_object_part_table_child_get (Evas_Object *obj, const char *part, unsigned int col, unsigned int row); + EAPI Eina_Bool edje_object_part_table_pack (Evas_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan); + EAPI Eina_Bool edje_object_part_table_unpack (Evas_Object *obj, const char *part, Evas_Object *child_obj); EAPI Eina_Bool edje_object_part_table_col_row_size_get (const Evas_Object *obj, const char *part, int *cols, int *rows); - EAPI Eina_Bool edje_object_part_table_clear (Evas_Object *obj, const char *part, Eina_Bool clear); + EAPI Eina_Bool edje_object_part_table_clear (Evas_Object *obj, const char *part, Eina_Bool clear); /* edje_message_queue.c */ - EAPI void edje_object_message_send (Evas_Object *obj, Edje_Message_Type type, int id, void *msg); - EAPI void edje_object_message_handler_set (Evas_Object *obj, Edje_Message_Handler_Cb func, void *data); - EAPI void edje_object_message_signal_process (Evas_Object *obj); + EAPI void edje_object_message_send (Evas_Object *obj, Edje_Message_Type type, int id, void *msg); + EAPI void edje_object_message_handler_set (Evas_Object *obj, Edje_Message_Handler_Cb func, void *data); + EAPI void edje_object_message_signal_process (Evas_Object *obj); - EAPI void edje_message_signal_process (void); + EAPI void edje_message_signal_process (void); /* edje_external.c */ - EAPI Eina_Bool edje_external_type_register(const char *type_name, const Edje_External_Type *type_info); - EAPI Eina_Bool edje_external_type_unregister(const char *type_name); + EAPI Eina_Bool edje_external_type_register (const char *type_name, const Edje_External_Type *type_info); + EAPI Eina_Bool edje_external_type_unregister (const char *type_name); - EAPI void edje_external_type_array_register(const Edje_External_Type_Info *array); - EAPI void edje_external_type_array_unregister(const Edje_External_Type_Info *array); + EAPI void edje_external_type_array_register (const Edje_External_Type_Info *array); + EAPI void edje_external_type_array_unregister (const Edje_External_Type_Info *array); - EAPI unsigned int edje_external_type_abi_version_get(void) EINA_CONST; + EAPI unsigned int edje_external_type_abi_version_get (void) EINA_CONST; - EAPI Eina_Iterator *edje_external_iterator_get(void); - EAPI Edje_External_Param *edje_external_param_find(const Eina_List *params, const char *key); - EAPI Eina_Bool edje_external_param_int_get(const Eina_List *params, const char *key, int *ret); - EAPI Eina_Bool edje_external_param_double_get(const Eina_List *params, const char *key, double *ret); - EAPI Eina_Bool edje_external_param_string_get(const Eina_List *params, const char *key, const char **ret); - EAPI Eina_Bool edje_external_param_bool_get(const Eina_List *params, const char *key, Eina_Bool *ret); - EAPI Eina_Bool edje_external_param_choice_get(const Eina_List *params, const char *key, const char **ret); - EAPI const Edje_External_Param_Info *edje_external_param_info_get(const char *type_name); - EAPI const Edje_External_Type *edje_external_type_get(const char *type_name); + EAPI Eina_Iterator *edje_external_iterator_get (void); + EAPI Edje_External_Param *edje_external_param_find (const Eina_List *params, const char *key); + EAPI Eina_Bool edje_external_param_int_get (const Eina_List *params, const char *key, int *ret); + EAPI Eina_Bool edje_external_param_double_get (const Eina_List *params, const char *key, double *ret); + EAPI Eina_Bool edje_external_param_string_get (const Eina_List *params, const char *key, const char **ret); + EAPI Eina_Bool edje_external_param_bool_get (const Eina_List *params, const char *key, Eina_Bool *ret); + EAPI Eina_Bool edje_external_param_choice_get (const Eina_List *params, const char *key, const char **ret); + EAPI const Edje_External_Param_Info *edje_external_param_info_get (const char *type_name); + EAPI const Edje_External_Type *edje_external_type_get (const char *type_name); /* edje_module.c */ - EAPI Eina_Bool edje_module_load(const char *module); - EAPI const Eina_List *edje_available_modules_get(void); + EAPI Eina_Bool edje_module_load (const char *module); + EAPI const Eina_List *edje_available_modules_get (void); /* perspective info for maps inside edje objects */ typedef struct _Edje_Perspective Edje_Perspective; diff --git a/src/lib/Edje_Edit.h b/src/lib/Edje_Edit.h index a0d0a82..6f9d4bb 100644 --- a/src/lib/Edje_Edit.h +++ b/src/lib/Edje_Edit.h @@ -493,6 +493,32 @@ EAPI Eina_Bool edje_edit_color_class_name_set(Evas_Object *obj, const char *name //@} +/** Add a new ttf font to the edje file. + * + * The newly created font will be available to all the groups in the edje, + * not only the current one. + * + * @param obj Object being edited. + * @param path Path to the font file to add into the Edje file. + * @param alias Name with which the font will be referred inside the Edje, + * can be NULL to use the filename. + * + * @return EINA_TRUE if the font got succesfully added, EINA_FALSE if not. + */ +EAPI Eina_Bool edje_edit_font_add(Evas_Object *obj, const char *path, const char *alias); + +/** Remove a ttf font to the edje file. + * + * The font exists at the file level, it's not per object. So deleting it + * will affect every group that is using it. + * + * @param obj Object being edited. + * @param alias Name by which the file is identified in the Edje file. + * + * @return EINA_TRUE if succesful, EINA_FALSE otherwise. + */ +EAPI Eina_Bool edje_edit_font_del(Evas_Object *obj, const char *alias); + /******************************************************************************/ /************************** TEXT STYLES *************************************/ /******************************************************************************/ @@ -731,45 +757,6 @@ EAPI Eina_Bool edje_edit_part_restack_above(Evas_Object *obj, const char *part); */ EAPI Eina_Bool edje_edit_part_name_set(Evas_Object *obj, const char *part, const char *new_name); -/**Add a new ttf font to the edje file. - * The newly created font will be available to all the groups in the edje, not only the current one. - * If font can't be load EINA_FALSE is returned. - */ -EAPI Eina_Bool ///@return EINA_TRUE on success or EINA_FALSE on failure -edje_edit_font_add( - Evas_Object *obj, ///< The edje object - const char* path, ///< The file path to load the ttf font from - const char* alias ///< The file alias, or NULL to use filename -); - -/**Remove a ttf font to the edje file. - * If font can't be deleted EINA_FALSE is returned. - */ -EAPI Eina_Bool ///@return EINA_TRUE on success or EINA_FALSE on failure -edje_edit_font_del( - Evas_Object *obj, ///< The edje object - const char* alias ///< The file alias -); - -/**Get font name for a given part state. Remember to free the returned string using edje_edit_string_free().*/ -EAPI const char * ///@return The name of the font used in the given part state -edje_edit_state_font_get( - Evas_Object *obj, ///< The edje object - const char *part, ///< The name of the part - const char *state, ///< The name of the 'part state' (ex. "default") - double value -); - -/**Set font name for a given part state. */ -EAPI void -edje_edit_state_font_set( - Evas_Object *obj, ///< The edje object - const char *part, ///< The name of the part - const char *state, ///< The name of the 'part state' (ex. "default") - double value, - const char *font ///< The name of the font to use in the given part state -); - /** Get the type of a part. * * @param obj Object being edited. @@ -2072,6 +2059,31 @@ EAPI const char * edje_edit_state_text_get(Evas_Object *obj, const char *part, c */ EAPI void edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, double value,const char *text); +/** Get font name for a given part state. + * + * @param obj Object being edited. + * @param part The name of the part to get the font of. + * @param state The state of the part to get the font of. + * @param value Value of the state. + * + * @return Font used by the part or NULL if error or nothing is set. + */ +EAPI const char * edje_edit_state_font_get(Evas_Object *obj, const char *part, const char *state, double value); + +/** Set font name for a given part state. + * + * Font name can be any alias of an internal font in the Edje file and, + * if it doesn't match any, Edje will look for a font with the given name + * in the system fonts. + * + * @param obj Object being edited. + * @param part Part to set the font of. + * @param state State in which the font is set. + * @param value Value of the state. + * @param font The font name to use. + */ +EAPI void edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state, double value, const char *font); + /** Get the text size of a part state * * @param obj Object being edited. diff --git a/src/lib/edje_cache.c b/src/lib/edje_cache.c index 4665321..f77a4c5 100644 --- a/src/lib/edje_cache.c +++ b/src/lib/edje_cache.c @@ -88,6 +88,7 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) if (data) { edc->script = embryo_program_new(data, size); + _edje_embryo_script_init(edc); free(data); } diff --git a/src/lib/edje_calc.c b/src/lib/edje_calc.c index 6e48ccd..692b716 100644 --- a/src/lib/edje_calc.c +++ b/src/lib/edje_calc.c @@ -122,7 +122,10 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl if (epd2 != NULL && (epd1 != epd2 || (ep->part->type == EDJE_PART_TYPE_IMAGE && epd2->image.tween_list))) { if (!ep->param2) - ep->param2 = eina_mempool_malloc(_edje_real_part_state_mp, sizeof (Edje_Real_Part_State)); + { + ep->param2 = eina_mempool_malloc(_edje_real_part_state_mp, sizeof (Edje_Real_Part_State)); + memset(ep->param2, 0, sizeof (Edje_Real_Part_State)); + } else if (ep->part->type == EDJE_PART_TYPE_EXTERNAL) _edje_external_parsed_params_free(ep->swallowed_object, ep->param2->external_params); ep->param2->external_params = NULL; @@ -132,6 +135,8 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl { if (ep->part->type == EDJE_PART_TYPE_EXTERNAL) _edje_external_parsed_params_free(ep->swallowed_object, ep->param2->external_params); + if (ep->param2) + free(ep->param2->set); eina_mempool_free(_edje_real_part_state_mp, ep->param2); ep->param2 = NULL; } @@ -1506,6 +1511,70 @@ _edje_table_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep, Edje_Calc_Para } } +static int +_edje_image_find(Evas_Object *obj, Edje *ed, Edje_Real_Part_Set **eps, Edje_Part_Description *st, Edje_Part_Image_Id *imid) +{ + Edje_Image_Directory_Set_Entry *entry; + Edje_Image_Directory_Set *set = NULL; + Eina_List *l; + int w = 0; + int h = 0; + int id; + + if (!st && !imid) + return -1; + + if (st && !st->image.set) + return st->image.id; + + if (imid && !imid->set) + return imid->id; + + if (imid) + id = imid->id; + else + id = st->image.id; + + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + + if (eps && *eps) + { + if ((*eps)->id == id) + set = (*eps)->set; + + if (set) + if ((*eps)->entry->size.min.w <= w && w <= (*eps)->entry->size.max.w) + if ((*eps)->entry->size.min.h <= h && h <= (*eps)->entry->size.max.h) + return (*eps)->entry->id; + } + + if (!set) + set = eina_list_nth(ed->file->image_dir->sets, id); + + EINA_LIST_FOREACH(set->entries, l, entry) + { + if (entry->size.min.w <= w && w <= entry->size.max.w) + if (entry->size.min.h <= h && h <= entry->size.max.h) + { + if (eps) + { + if (!*eps) + *eps = calloc(1, sizeof (Edje_Real_Part_Set)); + + if (*eps) + { + (*eps)->entry = entry; + (*eps)->set = set; + (*eps)->id = id; + } + } + return entry->id; + } + } + + return -1; +} + static void _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description *chosen_desc, FLOAT_T pos) { @@ -1530,7 +1599,9 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj evas_object_image_border_center_fill_set(ep->object, EVAS_BORDER_FILL_NONE); else if (chosen_desc->border.no_fill == 2) evas_object_image_border_center_fill_set(ep->object, EVAS_BORDER_FILL_SOLID); - image_id = ep->param1.description->image.id; + + image_id = _edje_image_find(ep->object, ed, + &ep->param1.set, ep->param1.description, NULL); if (image_id < 0) { Edje_Image_Directory_Entry *ie; @@ -1554,19 +1625,27 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj if (image_num > (image_count - 1)) image_num = image_count - 1; if (image_num == 0) - image_id = ep->param1.description->image.id; + { + image_id = _edje_image_find(ep->object, ed, + &ep->param1.set, ep->param1.description, + NULL); + } else if (ep->param2) { if (image_num == (image_count - 1)) - image_id = ep->param2->description->image.id; + { + image_id = _edje_image_find(ep->object, ed, + &ep->param2->set, ep->param2->description, + NULL); + } else { Edje_Part_Image_Id *imid; imid = eina_list_nth(ep->param2->description->image.tween_list, image_num - 1); - if (imid) image_id = imid->id; + image_id = _edje_image_find(ep->object, ed, NULL, NULL, imid); } } if (image_id < 0) diff --git a/src/lib/edje_data.c b/src/lib/edje_data.c index e62f16e..3b1465c 100644 --- a/src/lib/edje_data.c +++ b/src/lib/edje_data.c @@ -15,6 +15,8 @@ EAPI Eet_Data_Descriptor *_edje_edd_edje_font_directory = NULL; EAPI Eet_Data_Descriptor *_edje_edd_edje_font_directory_entry = NULL; EAPI Eet_Data_Descriptor *_edje_edd_edje_image_directory = NULL; EAPI Eet_Data_Descriptor *_edje_edd_edje_image_directory_entry = NULL; +EAPI Eet_Data_Descriptor *_edje_edd_edje_image_directory_set = NULL; +EAPI Eet_Data_Descriptor *_edje_edd_edje_image_directory_set_entry = NULL; EAPI Eet_Data_Descriptor *_edje_edd_edje_spectrum_directory = NULL; EAPI Eet_Data_Descriptor *_edje_edd_edje_spectrum_directory_entry = NULL; EAPI Eet_Data_Descriptor *_edje_edd_edje_spectrum_color = NULL; @@ -65,6 +67,8 @@ _edje_edd_shutdown(void) FREED(_edje_edd_edje_part_description); FREED(_edje_edd_edje_part_image_id); FREED(_edje_edd_edje_external_param); + FREED(_edje_edd_edje_image_directory_set); + FREED(_edje_edd_edje_image_directory_set_entry); } void @@ -104,10 +108,28 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "source_param", source_param, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_entry, Edje_Image_Directory_Entry, "id", id, EET_T_INT); + EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Set_Entry); + _edje_edd_edje_image_directory_set_entry = + eet_data_descriptor_file_new(&eddc); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "name", name, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "id", id, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "min.w", size.min.w, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "min.h", size.min.h, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "max.w", size.max.w, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set_entry, Edje_Image_Directory_Set_Entry, "max.h", size.max.h, EET_T_INT); + + EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory_Set); + _edje_edd_edje_image_directory_set = + eet_data_descriptor_file_new(&eddc); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "name", name, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "id", id, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory_set, Edje_Image_Directory_Set, "entries", entries, _edje_edd_edje_image_directory_set_entry); + EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Image_Directory); _edje_edd_edje_image_directory = eet_data_descriptor_file_new(&eddc); EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory, Edje_Image_Directory, "entries", entries, _edje_edd_edje_image_directory_entry); + EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_image_directory, Edje_Image_Directory, "sets", sets, _edje_edd_edje_image_directory_set); /* spectrum directory */ EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Spectrum_Color); @@ -238,6 +260,7 @@ _edje_edd_init(void) _edje_edd_edje_part_image_id = eet_data_descriptor_file_new(&eddc); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_image_id, Edje_Part_Image_Id, "id", id, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_image_id, Edje_Part_Image_Id, "set", set, EET_T_UCHAR); EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_External_Param); _edje_edd_edje_external_param = @@ -280,6 +303,7 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel2.id_x", rel2.id_x, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "rel2.id_y", rel2.id_y, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "image.id", image.id, EET_T_INT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "image.set", image.set, EET_T_UCHAR); EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_part_description, Edje_Part_Description, "image.tween_list", image.tween_list, _edje_edd_edje_part_image_id); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description, Edje_Part_Description, "border.l", border.l, EET_T_INT); diff --git a/src/lib/edje_edit.c b/src/lib/edje_edit.c index 90e4e65..7f9f2bf 100644 --- a/src/lib/edje_edit.c +++ b/src/lib/edje_edit.c @@ -287,7 +287,13 @@ _edje_real_part_free(Edje_Real_Part *rp) _edje_collection_free_part_description_free(rp->custom->description, 0); free(rp->drag); + + if (rp->param2) + free(rp->param2->set); eina_mempool_free(_edje_real_part_state_mp, rp->param2); + + if (rp->custom) + free(rp->custom->set); eina_mempool_free(_edje_real_part_state_mp, rp->custom); _edje_unref(rp->edje); @@ -868,24 +874,24 @@ edje_edit_group_add(Evas_Object *obj, const char *name) int search; //Code *cd; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); //printf("ADD GROUP: %s \n", name); /* check if a group with the same name already exists */ EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, d) if (!strcmp(d->entry, name)) - return 0; + return EINA_FALSE; /* Create structs */ de = _alloc(sizeof(Edje_Part_Collection_Directory_Entry)); - if (!de) return 0; + if (!de) return EINA_FALSE; pc = _alloc(sizeof(Edje_Part_Collection)); if (!pc) { free(de); - return 0; + return EINA_FALSE; } /* Search first free id */ @@ -931,7 +937,7 @@ edje_edit_group_add(Evas_Object *obj, const char *name) ed->file->collection_cache = eina_list_prepend(ed->file->collection_cache, pc); _edje_cache_coll_clean(ed->file); - return 1; + return EINA_TRUE; } /** @@ -1021,12 +1027,12 @@ edje_edit_group_exist(Evas_Object *obj, const char *group) Eina_List *l; Edje_Part_Collection_Directory_Entry *e; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); EINA_LIST_FOREACH(ed->file->collection_dir->entries, l, e) if (e->entry && !strcmp(e->entry, group)) - return 1; - return 0; + return EINA_TRUE; + return EINA_FALSE; } EAPI Eina_Bool @@ -1036,15 +1042,15 @@ edje_edit_group_name_set(Evas_Object *obj, const char *new_name) Edje_Part_Collection *pc; Edje_Part_Collection_Directory_Entry *pce; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); - if (!new_name) return 0; + if (!new_name) return EINA_FALSE; pc = ed->collection; - if (!strcmp(pc->part, new_name)) return 1; + if (!strcmp(pc->part, new_name)) return EINA_TRUE; - if (edje_edit_group_exist(obj, new_name)) return 0; + if (edje_edit_group_exist(obj, new_name)) return EINA_FALSE; _edje_edit_group_references_update(obj, pc->part, new_name); @@ -1070,10 +1076,10 @@ edje_edit_group_name_set(Evas_Object *obj, const char *new_name) // eina_stringshare_del(pce->entry); pce->entry = eina_stringshare_add(new_name); - return 1; + return EINA_TRUE; } } - return 0; + return EINA_FALSE; } EAPI int @@ -1223,17 +1229,17 @@ edje_edit_data_add(Evas_Object *obj, const char *itemname, const char *value) Edje_Data *d; Edje_Data *dd; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); if (!itemname || !ed->file) - return 0; + return EINA_FALSE; EINA_LIST_FOREACH(ed->file->data, l, dd) if (strcmp(dd->key, itemname) == 0) - return 0; + return EINA_FALSE; d = _alloc(sizeof(Edje_Data)); - if (!d) return 0; + if (!d) return EINA_FALSE; d->key = (char*)eina_stringshare_add(itemname); if (value) d->value = (char*)eina_stringshare_add(value); @@ -1241,7 +1247,7 @@ edje_edit_data_add(Evas_Object *obj, const char *itemname, const char *value) ed->file->data = eina_list_append(ed->file->data, d); - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -1278,7 +1284,7 @@ edje_edit_data_del(Evas_Object *obj, const char *itemname) Eina_List *l; Edje_Data *d; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); if (!itemname || !ed->file || !ed->file->data) return 0; @@ -1291,10 +1297,10 @@ edje_edit_data_del(Evas_Object *obj, const char *itemname) _edje_if_string_free(ed, d->value); ed->file->data = eina_list_remove(ed->file->data, d); free(d); - return 1; + return EINA_TRUE; } } - return 0; + return EINA_FALSE; } EAPI const char * @@ -1365,20 +1371,20 @@ edje_edit_data_value_set(Evas_Object *obj, const char *itemname, const char *val Eina_List *l; Edje_Data *d; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); if (!itemname || !value || !ed->file || !ed->file->data) - return 0; + return EINA_FALSE; EINA_LIST_FOREACH(ed->file->data, l, d) if (strcmp(d->key, itemname) == 0) { _edje_if_string_free(ed, d->value); d->value = (char*)eina_stringshare_add(value); - return 1; + return EINA_TRUE; } - return 0; + return EINA_FALSE; } EAPI Eina_Bool @@ -1413,20 +1419,20 @@ edje_edit_data_name_set(Evas_Object *obj, const char *itemname, const char *new Eina_List *l; Edje_Data *d; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); if (!itemname || !newname || !ed->file || !ed->file->data) - return 0; + return EINA_FALSE; EINA_LIST_FOREACH(ed->file->data, l, d) if (strcmp(d->key, itemname) == 0) { _edje_if_string_free(ed, d->key); d->key = (char*)eina_stringshare_add(newname); - return 1; + return EINA_TRUE; } - return 0; + return EINA_FALSE; } /***********************/ @@ -1457,10 +1463,10 @@ edje_edit_color_class_colors_get(Evas_Object *obj, const char *class_name, int * Eina_List *l; Edje_Color_Class *cc; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); if (!ed->file || !ed->file->color_classes) - return 0; + return EINA_FALSE; EINA_LIST_FOREACH(ed->file->color_classes, l, cc) if (!strcmp(cc->name, class_name)) @@ -1480,9 +1486,9 @@ edje_edit_color_class_colors_get(Evas_Object *obj, const char *class_name, int * if (b3) *b3 = cc->b3; if (a3) *a3 = cc->a3; - return 1; + return EINA_TRUE; } - return 0; + return EINA_FALSE; } EAPI Eina_Bool @@ -1491,10 +1497,10 @@ edje_edit_color_class_colors_set(Evas_Object *obj, const char *class_name, int r Eina_List *l; Edje_Color_Class *cc; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); if (!ed->file || !ed->file->color_classes) - return 0; + return EINA_FALSE; EINA_LIST_FOREACH(ed->file->color_classes, l, cc) if (!strcmp(cc->name, class_name)) @@ -1514,9 +1520,9 @@ edje_edit_color_class_colors_set(Evas_Object *obj, const char *class_name, int r if (b3 > -1) cc->b3 = b3; if (a3 > -1) cc->a3 = a3; - return 1; + return EINA_TRUE; } - return 0; + return EINA_FALSE; } EAPI Eina_Bool @@ -1526,17 +1532,17 @@ edje_edit_color_class_add(Evas_Object *obj, const char *name) Edje_Color_Class *c; Edje_Color_Class *cc; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); if (!name || !ed->file) - return 0; + return EINA_FALSE; EINA_LIST_FOREACH(ed->file->color_classes, l, cc) if (strcmp(cc->name, name) == 0) - return 0; + return EINA_FALSE; c = _alloc(sizeof(Edje_Color_Class)); - if (!c) return 0; + if (!c) return EINA_FALSE; c->name = (char*)eina_stringshare_add(name); c->r = c->g = c->b = c->a = 255; @@ -1545,7 +1551,7 @@ edje_edit_color_class_add(Evas_Object *obj, const char *name) ed->file->color_classes = eina_list_append(ed->file->color_classes, c); - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -1554,10 +1560,10 @@ edje_edit_color_class_del(Evas_Object *obj, const char *name) Eina_List *l; Edje_Color_Class *cc; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); if (!name || !ed->file || !ed->file->color_classes) - return 0; + return EINA_FALSE; EINA_LIST_FOREACH(ed->file->color_classes, l, cc) if (strcmp(cc->name, name) == 0) @@ -1565,9 +1571,9 @@ edje_edit_color_class_del(Evas_Object *obj, const char *name) _edje_if_string_free(ed, cc->name); ed->file->color_classes = eina_list_remove(ed->file->color_classes, cc); free(cc); - return 1; + return EINA_TRUE; } - return 0; + return EINA_FALSE; } EAPI Eina_Bool @@ -1576,20 +1582,20 @@ edje_edit_color_class_name_set(Evas_Object *obj, const char *name, const char *n Eina_List *l; Edje_Color_Class *cc; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); if (!ed->file || !ed->file->color_classes) - return 0; + return EINA_FALSE; EINA_LIST_FOREACH(ed->file->color_classes, l, cc) if (!strcmp(cc->name, name)) { _edje_if_string_free(ed, cc->name); cc->name = (char*)eina_stringshare_add(newname); - return 1; + return EINA_TRUE; } - return 0; + return EINA_FALSE; } @@ -1620,20 +1626,20 @@ EAPI Eina_Bool edje_edit_style_add(Evas_Object * obj, const char* style) { Edje_Style *s; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); //printf("ADD STYLE '%s'\n", style); s = _edje_edit_style_get(ed, style); - if (s) return 0; + if (s) return EINA_FALSE; s = _alloc(sizeof(Edje_Style)); - if (!s) return 0; + if (!s) return EINA_FALSE; s->name = (char*)eina_stringshare_add(style); s->tags = NULL; s->style = NULL; ed->file->styles = eina_list_append(ed->file->styles, s); - return 1; + return EINA_TRUE; } EAPI void @@ -1750,23 +1756,23 @@ edje_edit_style_tag_add(Evas_Object * obj, const char* style, const char* tag_na Edje_Style *s; Edje_Style_Tag *t; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); //printf("ADD TAG '%s' IN STYLE '%s'\n", tag_name, style); t = _edje_edit_style_tag_get(ed, style, tag_name); - if (t) return 0; + if (t) return EINA_FALSE; s = _edje_edit_style_get(ed, style); - if (!s) return 0; + if (!s) return EINA_FALSE; t = _alloc(sizeof(Edje_Style_Tag)); - if (!t) return 0; + if (!t) return EINA_FALSE; t->key = eina_stringshare_add(tag_name); t->value = NULL; t->font = NULL; t->text_class = NULL; s->tags = eina_list_append(s->tags, t); - return 1; + return EINA_TRUE; } EAPI void @@ -1885,18 +1891,18 @@ edje_edit_parts_list_get(Evas_Object *obj) EAPI Eina_Bool edje_edit_part_name_set(Evas_Object *obj, const char* part, const char* new_name) { - GET_RP_OR_RETURN(0); + GET_RP_OR_RETURN(EINA_FALSE); - if (!new_name) return 0; - if (!strcmp(part, new_name)) return 1; - if (_edje_real_part_get(ed, new_name)) return 0; + if (!new_name) return EINA_FALSE; + if (!strcmp(part, new_name)) return EINA_TRUE; + if (_edje_real_part_get(ed, new_name)) return EINA_FALSE; //printf("Set name of part: %s [new name: %s]\n", part, new_name); _edje_if_string_free(ed, rp->part->name); rp->part->name = (char *)eina_stringshare_add(new_name); - return 1; + return EINA_TRUE; } Eina_Bool @@ -1906,7 +1912,7 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type Edje_Part *ep; Edje_Real_Part *rp; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); //printf("ADD PART: %s [type: %d]\n", name, type); @@ -2053,7 +2059,7 @@ edje_edit_part_del(Evas_Object *obj, const char* part) Edje_Part_Collection *pc; int id; - GET_RP_OR_RETURN(0); + GET_RP_OR_RETURN(EINA_FALSE); //printf("REMOVE PART: %s\n", part); @@ -2143,8 +2149,8 @@ edje_edit_part_del(Evas_Object *obj, const char* part) EAPI Eina_Bool edje_edit_part_exist(Evas_Object *obj, const char *part) { - GET_RP_OR_RETURN(0); - return 1; + GET_RP_OR_RETURN(EINA_FALSE); + return EINA_TRUE; } EAPI const char* @@ -2181,11 +2187,11 @@ edje_edit_part_restack_below(Evas_Object *obj, const char* part) Edje_Part_Collection *group; Edje_Real_Part *prev; - GET_RP_OR_RETURN(0); + GET_RP_OR_RETURN(EINA_FALSE); //printf("RESTACK PART: %s BELOW\n", part); - if (rp->part->id < 1) return 0; + if (rp->part->id < 1) return EINA_FALSE; group = ed->collection; /* update parts list */ @@ -2199,7 +2205,7 @@ edje_edit_part_restack_below(Evas_Object *obj, const char* part) if (rp->swallowed_object) evas_object_stack_above(rp->swallowed_object, rp->object); - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -2208,11 +2214,11 @@ edje_edit_part_restack_above(Evas_Object *obj, const char* part) Edje_Part_Collection *group; Edje_Real_Part *next; - GET_RP_OR_RETURN(0); + GET_RP_OR_RETURN(EINA_FALSE); //printf("RESTACK PART: %s ABOVE\n", part); - if (rp->part->id >= ed->table_parts_size - 1) return 0; + if (rp->part->id >= ed->table_parts_size - 1) return EINA_FALSE; group = ed->collection; @@ -2228,7 +2234,7 @@ edje_edit_part_restack_above(Evas_Object *obj, const char* part) if (rp->swallowed_object) evas_object_stack_above(rp->swallowed_object, rp->object); - return 1; + return EINA_TRUE; } EAPI Edje_Part_Type @@ -2259,16 +2265,16 @@ edje_edit_part_selected_state_set(Evas_Object *obj, const char *part, const char { Edje_Part_Description *pd; - GET_RP_OR_RETURN(0); + GET_RP_OR_RETURN(EINA_FALSE); pd = _edje_part_description_find_byname(eed, part, state, value); - if (!pd) return 0; + if (!pd) return EINA_FALSE; //printf("EDJE: Set state: %s %f\n", pd->state.name, pd->state.value); _edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, NULL, 0.0); edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } EAPI const char * @@ -2293,7 +2299,7 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_ Edje_Real_Part *clip; Evas_Object *o, *oo; - GET_RP_OR_RETURN(0); + GET_RP_OR_RETURN(EINA_FALSE); /* unset clipping */ if (!clip_to) @@ -2316,18 +2322,18 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_ edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } /* set clipping */ //printf("Set clip_to for part: %s [to: %s]\n", part, clip_to); clip = _edje_real_part_get(ed, clip_to); - if (!clip || !clip->part) return 0; + if (!clip || !clip->part) return EINA_FALSE; o = clip->object; while ((oo = evas_object_clip_get(o))) { if (o == rp->object) - return 0; + return EINA_FALSE; o = oo; } @@ -2342,13 +2348,13 @@ edje_edit_part_clip_to_set(Evas_Object *obj, const char *part, const char *clip_ edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } EAPI Eina_Bool edje_edit_part_mouse_events_get(Evas_Object *obj, const char *part) { - GET_RP_OR_RETURN(0); + GET_RP_OR_RETURN(EINA_FALSE); //printf("Get mouse_events for part: %s [%d]\n", part, rp->part->mouse_events); return rp->part->mouse_events; } @@ -2379,7 +2385,7 @@ edje_edit_part_mouse_events_set(Evas_Object *obj, const char *part, Eina_Bool mo EAPI Eina_Bool edje_edit_part_repeat_events_get(Evas_Object *obj, const char *part) { - GET_RP_OR_RETURN(0); + GET_RP_OR_RETURN(EINA_FALSE); //printf("Get repeat_events for part: %s [%d]\n", part, rp->part->repeat_events); return rp->part->repeat_events; @@ -2437,13 +2443,13 @@ edje_edit_part_source_get(Evas_Object *obj, const char *part) EAPI Eina_Bool edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source) { - GET_RP_OR_RETURN(0); + GET_RP_OR_RETURN(EINA_FALSE); Evas_Object *child_obj; //printf("Set source for part: %s [source: %s]\n", part, source); if (rp->part->type == EDJE_PART_TYPE_EXTERNAL) - return 0; + return EINA_FALSE; _edje_if_string_free(ed, rp->part->source); @@ -2462,7 +2468,7 @@ edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source } else rp->part->source = NULL; - return 1; + return EINA_TRUE; } EAPI int @@ -2696,7 +2702,7 @@ edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state, int part_id; int i; - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("Set name of state: %s in part: %s [new name: %s]\n", // part, state, new_name); @@ -2882,8 +2888,8 @@ edje_edit_state_add(Evas_Object *obj, const char *part, const char *name, double EAPI Eina_Bool edje_edit_state_exist(Evas_Object *obj, const char *part, const char *state, double value) { - GET_PD_OR_RETURN(0); - return 1; + GET_PD_OR_RETURN(EINA_FALSE); + return EINA_TRUE; } EAPI Eina_Bool @@ -2893,18 +2899,18 @@ edje_edit_state_copy(Evas_Object *obj, const char *part, const char *from, doubl Edje_Part_Image_Id *i; Edje_External_Param *p; Eina_List *l; - GET_RP_OR_RETURN(0); + GET_RP_OR_RETURN(EINA_FALSE); pdfrom = _edje_part_description_find_byname(eed, part, from, val_from); if (!pdfrom) - return 0; + return EINA_FALSE; pdto = _edje_part_description_find_byname(eed, part, to, val_to); if (!pdto) { pdto = _alloc(sizeof(Edje_Part_Description)); if (!pdto) - return 0; + return EINA_FALSE; /* No need to check for default desc, at this point it must exist */ rp->part->other_desc = eina_list_append(rp->part->other_desc, pdto); pdto->state.name = eina_stringshare_add(to); @@ -3055,7 +3061,7 @@ edje_edit_state_copy(Evas_Object *obj, const char *part, const char *from, doubl #undef PD_STRING_COPY #undef PD_COPY - return 1; + return EINA_TRUE; } //relative @@ -3766,7 +3772,7 @@ edje_edit_state_fill_size_offset_y_set(Evas_Object *obj, const char *part, const EAPI Eina_Bool edje_edit_state_visible_get(Evas_Object *obj, const char *part, const char *state, double value) { - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("Get state visible flag of part: %s state: %s\n", part, state); return pd->visible; } @@ -4174,7 +4180,7 @@ edje_edit_state_text_elipsis_set(Evas_Object *obj, const char *part, const char EAPI Eina_Bool edje_edit_state_text_fit_x_get(Evas_Object *obj, const char *part, const char *state, double value) { - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("GET TEXT_FIT_VERT of state: %s \n", state); return pd->text.fit_x; } @@ -4193,7 +4199,7 @@ edje_edit_state_text_fit_x_set(Evas_Object *obj, const char *part, const char *s EAPI Eina_Bool edje_edit_state_text_fit_y_get(Evas_Object *obj, const char *part, const char *state, double value) { - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("GET TEXT_FIT_VERT of state: %s \n", state); return pd->text.fit_y; } @@ -4605,24 +4611,24 @@ edje_edit_image_data_add(Evas_Object *obj, const char *name, int id) Edje_Image_Directory_Entry *de; Edje_Image_Directory_Entry *i, *t; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); - if (!name) return 0; - if (!ed->file) return 0; - if (!ed->path) return 0; + if (!name) return EINA_FALSE; + if (!ed->file) return EINA_FALSE; + if (!ed->path) return EINA_FALSE; /* Create Image_Directory if not exist */ if (!ed->file->image_dir) { ed->file->image_dir = _alloc(sizeof(Edje_Image_Directory)); - if (!ed->file->image_dir) return 0; + if (!ed->file->image_dir) return EINA_FALSE; } /* Loop trough image directory to find if image exist */ t = NULL; EINA_LIST_FOREACH(ed->file->image_dir->entries, l, i) { - if (!i) return 0; + if (!i) return EINA_FALSE; if (i->id == id) t = i; } @@ -4630,7 +4636,7 @@ edje_edit_image_data_add(Evas_Object *obj, const char *name, int id) if (!t) { de = _alloc(sizeof(Edje_Image_Directory_Entry)); - if (!de) return 0; + if (!de) return EINA_FALSE; } else { @@ -4647,7 +4653,7 @@ edje_edit_image_data_add(Evas_Object *obj, const char *name, int id) ed->file->image_dir->entries = eina_list_append(ed->file->image_dir->entries, de); - return 1; + return EINA_TRUE; } EAPI int @@ -4774,20 +4780,20 @@ edje_edit_state_tween_add(Evas_Object *obj, const char *part, const char *state, Edje_Part_Image_Id *i; int id; - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); id = _edje_image_id_find(obj, tween); - if (id < 0) return 0; + if (id < EINA_FALSE) return 0; /* alloc Edje_Part_Image_Id */ i = _alloc(sizeof(Edje_Part_Image_Id)); - if (!i) return 0; + if (!i) return EINA_FALSE; i->id = id; /* add to tween list */ pd->image.tween_list = eina_list_append(pd->image.tween_list, i); - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -4797,22 +4803,22 @@ edje_edit_state_tween_del(Evas_Object *obj, const char *part, const char *state, Edje_Part_Image_Id *i; int id; - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); - if (!pd->image.tween_list) return 0; + if (!pd->image.tween_list) return EINA_FALSE; id = _edje_image_id_find(obj, tween); - if (id < 0) return 0; + if (id < 0) return EINA_FALSE; EINA_LIST_FOREACH(pd->image.tween_list, l, i) { if (i->id == id) { pd->image.tween_list = eina_list_remove_list(pd->image.tween_list, l); - return 1; + return EINA_TRUE; } } - return 0; + return EINA_FALSE; } EAPI void @@ -4894,31 +4900,31 @@ edje_edit_spectrum_list_get(Evas_Object *obj) EAPI Eina_Bool edje_edit_spectra_add(Evas_Object *obj, const char* name) { - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); //printf("SPECTRA ADD [new name:%s]\n", name); Edje_Spectrum_Directory_Entry *s; - if (!ed->file) return 0; + if (!ed->file) return EINA_FALSE; - if (_edje_edit_spectrum_entry_get(ed, name)) return 0; + if (_edje_edit_spectrum_entry_get(ed, name)) return EINA_FALSE; if (!ed->file->spectrum_dir) { ed->file->spectrum_dir = _alloc(sizeof(Edje_Spectrum_Directory)); - if (!ed->file->spectrum_dir) return 0; + if (!ed->file->spectrum_dir) return EINA_FALSE; } s = _alloc(sizeof(Edje_Spectrum_Directory_Entry)); - if (!s) return 0; + if (!s) return EINA_FALSE; ed->file->spectrum_dir->entries = eina_list_append(ed->file->spectrum_dir->entries, s); s->id = eina_list_count(ed->file->spectrum_dir->entries) - 1; //TODO Search for id holes s->entry = (char*)eina_stringshare_add(name); s->filename = NULL; s->color_list = NULL; - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -4926,10 +4932,10 @@ edje_edit_spectra_del(Evas_Object *obj, const char* spectra) { Edje_Spectrum_Directory_Entry *s; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); s = _edje_edit_spectrum_entry_get(ed, spectra); - if (!s) return 0; + if (!s) return EINA_FALSE; //printf("SPECTRA DEL %s\n", spectra); @@ -4945,7 +4951,7 @@ edje_edit_spectra_del(Evas_Object *obj, const char* spectra) } free(s); - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -4953,17 +4959,17 @@ edje_edit_spectra_name_set(Evas_Object *obj, const char* spectra, const char* na { Edje_Spectrum_Directory_Entry *s; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); //printf("SET SPECTRA NAME for spectra: %s [new name:%s]\n", spectra, name); s = _edje_edit_spectrum_entry_get(ed, spectra); - if (!s) return 0; + if (!s) return EINA_FALSE; _edje_if_string_free(ed, s->entry); s->entry = (char*)eina_stringshare_add(name); - return 1; + return EINA_TRUE; } EAPI int @@ -4971,12 +4977,12 @@ edje_edit_spectra_stop_num_get(Evas_Object *obj, const char* spectra) { Edje_Spectrum_Directory_Entry *s; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); //printf("GET SPECTRA STOP NUM for spectra: %s\n", spectra); s = _edje_edit_spectrum_entry_get(ed, spectra); - if (!s) return 0; + if (!s) return EINA_FALSE; return eina_list_count(s->color_list); } @@ -4986,14 +4992,14 @@ edje_edit_spectra_stop_num_set(Evas_Object *obj, const char* spectra, int num) { Edje_Spectrum_Directory_Entry *s; Edje_Spectrum_Color *color; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); //printf("SET SPECTRA STOP NUM for spectra: %s\n", spectra); s = _edje_edit_spectrum_entry_get(ed, spectra); - if (!s) return 0; + if (!s) return EINA_FALSE; - if (num == eina_list_count(s->color_list)) return 1; + if (num == eina_list_count(s->color_list)) return EINA_TRUE; //destroy all colors while (s->color_list) @@ -5007,7 +5013,7 @@ edje_edit_spectra_stop_num_set(Evas_Object *obj, const char* spectra, int num) while (num) { color = _alloc(sizeof(Edje_Spectrum_Color)); - if (!color) return 0; + if (!color) return EINA_FALSE; s->color_list = eina_list_append(s->color_list, color); color->r = 255; color->g = 255; @@ -5017,7 +5023,7 @@ edje_edit_spectra_stop_num_set(Evas_Object *obj, const char* spectra, int num) num--; } - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -5025,21 +5031,21 @@ edje_edit_spectra_stop_color_get(Evas_Object *obj, const char* spectra, int stop { Edje_Spectrum_Directory_Entry *s; Edje_Spectrum_Color *color; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); s = _edje_edit_spectrum_entry_get(ed, spectra); - if (!s) return 0; + if (!s) return EINA_FALSE; //printf("GET SPECTRA STOP COLOR for spectra: %s stopn: %d\n", spectra, stop_number); color = eina_list_nth(s->color_list, stop_number); - if (!color) return 0; + if (!color) return EINA_FALSE; if (r) *r = color->r; if (g) *g = color->g; if (b) *b = color->b; if (a) *a = color->a; if (d) *d = color->d; - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -5047,14 +5053,14 @@ edje_edit_spectra_stop_color_set(Evas_Object *obj, const char* spectra, int stop { Edje_Spectrum_Directory_Entry *s; Edje_Spectrum_Color *color; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); s = _edje_edit_spectrum_entry_get(ed, spectra); - if (!s) return 0; + if (!s) return EINA_FALSE; //printf("SET SPECTRA STOP COLOR for spectra: %s stopn: %d\n", spectra, stop_number); color = eina_list_nth(s->color_list, stop_number); - if (!color) return 0; + if (!color) return EINA_FALSE; color->r = r; color->g = g; color->b = b; @@ -5063,7 +5069,7 @@ edje_edit_spectra_stop_color_set(Evas_Object *obj, const char* spectra, int stop edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } @@ -5087,29 +5093,29 @@ edje_edit_state_gradient_type_get(Evas_Object *obj, const char *part, const char EAPI Eina_Bool edje_edit_state_gradient_type_set(Evas_Object *obj, const char *part, const char *state, double value, const char *type) { - GET_PD_OR_RETURN(0); - if (!type) return 0; + GET_PD_OR_RETURN(EINA_FALSE); + if (!type) return EINA_FALSE; // printf("SET GRADIENT TYPE for part: %s state: %s TO: %s\n", part, state, type); _edje_if_string_free(ed, pd->gradient.type); pd->gradient.type = (char *)eina_stringshare_add(type); edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } EAPI Eina_Bool edje_edit_state_gradient_use_fill_get(Evas_Object *obj, const char *part, const char *state, double value) { - GET_PD_OR_RETURN(-1); + GET_PD_OR_RETURN(EINA_FALSE); if (!pd->gradient.type) - return -1; + return EINA_FALSE; //~ if (!strcmp(pd->gradient.type, "linear")) //~ return 0; - return 1; + return EINA_TRUE; } EAPI const char * @@ -5131,17 +5137,17 @@ edje_edit_state_gradient_spectra_set(Evas_Object *obj, const char *part, const c { Edje_Spectrum_Directory_Entry *s; - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("SET GRADIENT SPECTRA for part: %s state: %s [%s]\n", part, state, spectra); s = _edje_edit_spectrum_entry_get(ed, spectra); - if (!s) return 0; + if (!s) return EINA_FALSE; pd->gradient.id = s->id; edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } EAPI int @@ -5198,45 +5204,45 @@ edje_edit_state_gradient_rel2_relative_y_get(Evas_Object *obj, const char *part, EAPI Eina_Bool edje_edit_state_gradient_rel1_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double val) { - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("SET GRADIENT REL1 RELX for part: %s state: %s [TO %f]\n", part, state, val); pd->gradient.rel1.relative_x = FROM_DOUBLE(val); edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } EAPI Eina_Bool edje_edit_state_gradient_rel1_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double val) { - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("SET GRADIENT REL1 RELY for part: %s state: %s [TO %f]\n", part, state, val); pd->gradient.rel1.relative_y = FROM_DOUBLE(val); edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } EAPI Eina_Bool edje_edit_state_gradient_rel2_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double val) { - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("SET GRADIENT REL2 RELX for part: %s state: %s [TO %f]\n", part, state, val); pd->gradient.rel2.relative_x = FROM_DOUBLE(val); edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } EAPI Eina_Bool edje_edit_state_gradient_rel2_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double val) { - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("SET GRADIENT REL2 RELY for part: %s state: %s [TO %f]\n", part, state, val); pd->gradient.rel2.relative_y = FROM_DOUBLE(val); edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } EAPI int @@ -5274,45 +5280,45 @@ edje_edit_state_gradient_rel2_offset_y_get(Evas_Object *obj, const char *part, c EAPI Eina_Bool edje_edit_state_gradient_rel1_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, int val) { - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("SET GRADIENT REL1 OFFSETX for part: %s state: %s [TO %d]\n", part, state, val); pd->gradient.rel1.offset_x = val; edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } EAPI Eina_Bool edje_edit_state_gradient_rel1_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, int val) { - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("SET GRADIENT REL1 OFFSETY for part: %s state: %s [TO %d]\n", part, state, val); pd->gradient.rel1.offset_y = val; edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } EAPI Eina_Bool edje_edit_state_gradient_rel2_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, int val) { - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("SET GRADIENT REL2 OFFSETX for part: %s state: %s [TO %d]\n", part, state, val); pd->gradient.rel2.offset_x = val; edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } EAPI Eina_Bool edje_edit_state_gradient_rel2_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, int val) { - GET_PD_OR_RETURN(0); + GET_PD_OR_RETURN(EINA_FALSE); //printf("SET GRADIENT REL2 OFFSETY for part: %s state: %s [TO %d]\n", part, state, val); pd->gradient.rel2.offset_y = val; edje_object_calc_force(obj); - return 1; + return EINA_TRUE; } /******************/ @@ -5364,17 +5370,17 @@ edje_edit_program_add(Evas_Object *obj, const char *name) Edje_Program *epr; Edje_Part_Collection *pc; - GET_ED_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); //printf("ADD PROGRAM [new name: %s]\n", name); //Check if program already exists if (_edje_program_get_byname(obj, name)) - return 0; + return EINA_FALSE; //Alloc Edje_Program or return epr = _alloc(sizeof(Edje_Program)); - if (!epr) return 0; + if (!epr) return EINA_FALSE; //Add program to group pc = ed->collection; @@ -5410,7 +5416,7 @@ edje_edit_program_add(Evas_Object *obj, const char *name) _edje_programs_patterns_clean(ed); _edje_programs_patterns_init(ed); - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -5513,37 +5519,37 @@ edje_edit_program_del(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_exist(Evas_Object *obj, const char *prog) { - GET_EPR_OR_RETURN(0); + GET_EPR_OR_RETURN(EINA_FALSE); - return 1; + return EINA_TRUE; } EAPI Eina_Bool edje_edit_program_run(Evas_Object *obj, const char *prog) { - GET_ED_OR_RETURN(0); - GET_EPR_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); + GET_EPR_OR_RETURN(EINA_FALSE); _edje_program_run(ed, epr, 0, "", ""); - return 1; + return EINA_TRUE; } EAPI Eina_Bool edje_edit_program_name_set(Evas_Object *obj, const char *prog, const char* new_name) { - GET_ED_OR_RETURN(0); - GET_EPR_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); + GET_EPR_OR_RETURN(EINA_FALSE); - if (!new_name) return 0; + if (!new_name) return EINA_FALSE; - if (_edje_program_get_byname(obj, new_name)) return 0; + if (_edje_program_get_byname(obj, new_name)) return EINA_FALSE; //printf("SET NAME for program: %s [new name: %s]\n", prog, new_name); _edje_if_string_free(ed, epr->name); epr->name = eina_stringshare_add(new_name); - return 1; + return EINA_TRUE; } EAPI const char * @@ -5559,10 +5565,10 @@ edje_edit_program_source_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_source_set(Evas_Object *obj, const char *prog, const char *source) { - GET_ED_OR_RETURN(0); - GET_EPR_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); + GET_EPR_OR_RETURN(EINA_FALSE); - if (!source) return 0; + if (!source) return EINA_FALSE; //printf("SET SOURCE for program: %s [%s]\n", prog, source); @@ -5574,7 +5580,7 @@ edje_edit_program_source_set(Evas_Object *obj, const char *prog, const char *sou edje_match_patterns_free(ed->patterns.programs.sources_patterns); ed->patterns.programs.sources_patterns = edje_match_programs_source_init(ed->collection->programs); - return 1; + return EINA_TRUE; } EAPI const char * @@ -5589,15 +5595,15 @@ edje_edit_program_filter_part_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_filter_part_set(Evas_Object *obj, const char *prog, const char *filter_part) { - GET_ED_OR_RETURN(0); - GET_EPR_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); + GET_EPR_OR_RETURN(EINA_FALSE); - if (!filter_part) return 0; + if (!filter_part) return EINA_FALSE; _edje_if_string_free(ed, epr->filter.part); epr->filter.part = eina_stringshare_add(filter_part); - return 1; + return EINA_TRUE; } EAPI const char * @@ -5612,15 +5618,15 @@ edje_edit_program_filter_state_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_filter_state_set(Evas_Object *obj, const char *prog, const char *filter_state) { - GET_ED_OR_RETURN(0); - GET_EPR_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); + GET_EPR_OR_RETURN(EINA_FALSE); - if (!filter_state) return 0; + if (!filter_state) return EINA_FALSE; _edje_if_string_free(ed, epr->filter.state); epr->filter.state = eina_stringshare_add(filter_state); - return 1; + return EINA_TRUE; } EAPI const char * @@ -5636,10 +5642,10 @@ edje_edit_program_signal_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_signal_set(Evas_Object *obj, const char *prog, const char *signal) { - GET_ED_OR_RETURN(0); - GET_EPR_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); + GET_EPR_OR_RETURN(EINA_FALSE); - if (!signal) return 0; + if (!signal) return EINA_FALSE; //printf("SET SIGNAL for program: %s [%s]\n", prog, signal); @@ -5651,7 +5657,7 @@ edje_edit_program_signal_set(Evas_Object *obj, const char *prog, const char *sig edje_match_patterns_free(ed->patterns.programs.signals_patterns); ed->patterns.programs.signals_patterns = edje_match_programs_signal_init(ed->collection->programs); - return 1; + return EINA_TRUE; } EAPI const char * @@ -5667,15 +5673,15 @@ edje_edit_program_state_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_state_set(Evas_Object *obj, const char *prog, const char *state) { - GET_ED_OR_RETURN(0); - GET_EPR_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); + GET_EPR_OR_RETURN(EINA_FALSE); //printf("SET STATE for program: %s\n", prog); _edje_if_string_free(ed, epr->state); epr->state = eina_stringshare_add(state); - return 1; + return EINA_TRUE; } EAPI const char * @@ -5691,15 +5697,15 @@ edje_edit_program_state2_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_state2_set(Evas_Object *obj, const char *prog, const char *state2) { - GET_ED_OR_RETURN(0); - GET_EPR_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); + GET_EPR_OR_RETURN(EINA_FALSE); //printf("SET STATE2 for program: %s\n", prog); _edje_if_string_free(ed, epr->state2); epr->state2 = eina_stringshare_add(state2); - return 1; + return EINA_TRUE; } EAPI double @@ -5714,11 +5720,11 @@ edje_edit_program_value_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_value_set(Evas_Object *obj, const char *prog, double value) { - GET_EPR_OR_RETURN(0); + GET_EPR_OR_RETURN(EINA_FALSE); //printf("SET VALUE for program: %s [%.2f]\n", prog, value); epr->value = value; - return 1; + return EINA_TRUE; } EAPI double @@ -5733,11 +5739,11 @@ edje_edit_program_value2_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_value2_set(Evas_Object *obj, const char *prog, double value) { - GET_EPR_OR_RETURN(0); + GET_EPR_OR_RETURN(EINA_FALSE); //printf("SET VALUE for program: %s [%.2f]\n", prog, value); epr->value2 = value; - return 1; + return EINA_TRUE; } EAPI double @@ -5752,11 +5758,11 @@ edje_edit_program_in_from_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_in_from_set(Evas_Object *obj, const char *prog, double seconds) { - GET_EPR_OR_RETURN(0); + GET_EPR_OR_RETURN(EINA_FALSE); //printf("SET IN.FROM for program: %s [%f]\n", prog, epr->in.from); epr->in.from = seconds; - return 1; + return EINA_TRUE; } EAPI double @@ -5771,11 +5777,11 @@ edje_edit_program_in_range_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_in_range_set(Evas_Object *obj, const char *prog, double seconds) { - GET_EPR_OR_RETURN(0); + GET_EPR_OR_RETURN(EINA_FALSE); //printf("SET IN.RANGE for program: %s [%f]\n", prog, epr->in.range); epr->in.range = seconds; - return 1; + return EINA_TRUE; } EAPI Edje_Tween_Mode @@ -5790,11 +5796,11 @@ edje_edit_program_transition_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_transition_set(Evas_Object *obj, const char *prog, Edje_Tween_Mode transition) { - GET_EPR_OR_RETURN(0); + GET_EPR_OR_RETURN(EINA_FALSE); //printf("GET TRANSITION for program: %s [%d]\n", prog, epr->tween.mode); epr->tween.mode = transition; - return 1; + return EINA_TRUE; } EAPI double @@ -5809,11 +5815,11 @@ edje_edit_program_transition_time_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_transition_time_set(Evas_Object *obj, const char *prog, double seconds) { - GET_EPR_OR_RETURN(0); + GET_EPR_OR_RETURN(EINA_FALSE); //printf("GET TRANSITION_TIME for program: %s [%.4f]\n", prog, epr->tween.time); epr->tween.time = FROM_DOUBLE(seconds); - return 1; + return EINA_TRUE; } EAPI Edje_Action_Type @@ -5828,13 +5834,13 @@ edje_edit_program_action_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_action_set(Evas_Object *obj, const char *prog, Edje_Action_Type action) { - GET_EPR_OR_RETURN(0); + GET_EPR_OR_RETURN(EINA_FALSE); //printf("SET ACTION for program: %s [%d]\n", prog, action); - if (action >= EDJE_ACTION_TYPE_LAST) return 0; + if (action >= EDJE_ACTION_TYPE_LAST) return EINA_FALSE; epr->action = action; - return 1; + return EINA_TRUE; } EAPI Eina_List * @@ -5876,7 +5882,7 @@ edje_edit_program_targets_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_targets_clear(Evas_Object *obj, const char *prog) { - GET_EPR_OR_RETURN(0); + GET_EPR_OR_RETURN(EINA_FALSE); while (epr->targets) { @@ -5887,7 +5893,7 @@ edje_edit_program_targets_clear(Evas_Object *obj, const char *prog) free(prt); } - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -5896,8 +5902,8 @@ edje_edit_program_target_add(Evas_Object *obj, const char *prog, const char *tar int id; Edje_Program_Target *t; - GET_ED_OR_RETURN(0); - GET_EPR_OR_RETURN(0); + GET_ED_OR_RETURN(EINA_FALSE); + GET_EPR_OR_RETURN(EINA_FALSE); if (epr->action == EDJE_ACTION_TYPE_STATE_SET) { @@ -5905,7 +5911,7 @@ edje_edit_program_target_add(Evas_Object *obj, const char *prog, const char *tar Edje_Real_Part *rp; rp = _edje_real_part_get(ed, target); - if (!rp) return 0; + if (!rp) return EINA_FALSE; id = rp->part->id; } else if (epr->action == EDJE_ACTION_TYPE_ACTION_STOP) @@ -5914,19 +5920,19 @@ edje_edit_program_target_add(Evas_Object *obj, const char *prog, const char *tar Edje_Program *tar; tar = _edje_program_get_byname(obj, target); - if (!tar) return 0; + if (!tar) return EINA_FALSE; id = tar->id; } else - return 0; + return EINA_FALSE; t = _alloc(sizeof(Edje_Program_Target)); - if (!t) return 0; + if (!t) return EINA_FALSE; t->id = id; epr->targets = eina_list_append(epr->targets, t); - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -5996,7 +6002,7 @@ edje_edit_program_afters_get(Evas_Object *obj, const char *prog) EAPI Eina_Bool edje_edit_program_afters_clear(Evas_Object *obj, const char *prog) { - GET_EPR_OR_RETURN(0); + GET_EPR_OR_RETURN(EINA_FALSE); while (epr->after) { @@ -6007,7 +6013,7 @@ edje_edit_program_afters_clear(Evas_Object *obj, const char *prog) free(pa); } - return 1; + return EINA_TRUE; } EAPI Eina_Bool @@ -6016,19 +6022,19 @@ edje_edit_program_after_add(Evas_Object *obj, const char *prog, const char *afte Edje_Program *af; Edje_Program_After *a; - GET_EPR_OR_RETURN(0); + GET_EPR_OR_RETURN(EINA_FALSE); af = _edje_program_get_byname(obj, after); - if (!af) return 0; + if (!af) return EINA_FALSE; a = _alloc(sizeof(Edje_Program_After)); - if (!a) return 0; + if (!a) return EINA_FALSE; a->id = af->id; epr->after = eina_list_append(epr->after, a); - return 1; + return EINA_TRUE; } EAPI Eina_Bool diff --git a/src/lib/edje_embryo.c b/src/lib/edje_embryo.c index 14c5d7a..873516a 100644 --- a/src/lib/edje_embryo.c +++ b/src/lib/edje_embryo.c @@ -1595,6 +1595,8 @@ _edje_embryo_fn_custom_state(Embryo_Program *ep, Embryo_Cell *params) return 0; } + memset(rp->custom, 0, sizeof (Edje_Real_Part_State)); + *d = *parent; d->state.name = (char *)eina_stringshare_add("custom"); @@ -2658,15 +2660,14 @@ _edje_embryo_fn_external_param_set_bool(Embryo_Program *ep, Embryo_Cell *params) } void -_edje_embryo_script_init(Edje *ed) +_edje_embryo_script_init(Edje_Part_Collection *edc) { Embryo_Program *ep; - if (!ed) return; - if (!ed->collection) return; - if (!ed->collection->script) return; - ep = ed->collection->script; - embryo_program_data_set(ep, ed); + if (!edc) return; + if (!edc->script) return; + + ep = edc->script; /* first advertise all the edje "script" calls */ embryo_program_native_call_add(ep, "get_int", _edje_embryo_fn_get_int); embryo_program_native_call_add(ep, "set_int", _edje_embryo_fn_set_int); @@ -2748,21 +2749,16 @@ _edje_embryo_script_init(Edje *ed) embryo_program_native_call_add(ep, "external_param_set_choice", _edje_embryo_fn_external_param_set_choice); embryo_program_native_call_add(ep, "external_param_get_bool", _edje_embryo_fn_external_param_get_bool); embryo_program_native_call_add(ep, "external_param_set_bool", _edje_embryo_fn_external_param_set_bool); - -// embryo_program_vm_push(ed->collection->script); -// _edje_embryo_globals_init(ed); } void -_edje_embryo_script_shutdown(Edje *ed) +_edje_embryo_script_shutdown(Edje_Part_Collection *edc) { - if (!ed) return; - if (!ed->collection) return; - if (!ed->collection->script) return; - if (embryo_program_recursion_get(ed->collection->script) > 0) return; -// embryo_program_vm_pop(ed->collection->script); - embryo_program_free(ed->collection->script); - ed->collection->script = NULL; + if (!edc) return; + if (!edc->script) return; + if (embryo_program_recursion_get(edc->script) > 0) return; + embryo_program_free(edc->script); + edc->script = NULL; } void diff --git a/src/lib/edje_entry.c b/src/lib/edje_entry.c index 2bcc1d0..17818e1 100644 --- a/src/lib/edje_entry.c +++ b/src/lib/edje_entry.c @@ -177,6 +177,32 @@ _edje_focus_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, #endif } +// need one for markup and format too - how to do it? extra type param? +static void +_text_filter_prepend(Entry *en, const char *text) +{ + char *text2; + Edje_Text_Insert_Filter_Callback *cb; + Eina_List *l; + + text2 = strdup(text); + EINA_LIST_FOREACH(en->rp->edje->text_insert_filter_callbacks, l, cb) + { + if (!strcmp(cb->part, en->rp->part->name)) + { + cb->func(cb->data, en->rp->edje->obj, cb->part, &text2); + if (!text2) break; + } + } + if (text2) + { + evas_textblock_cursor_text_prepend(en->cursor, text2); +// evas_textblock_cursor_format_prepend(en->cursor, text2); +// evas_object_textblock_text_markup_prepend(en->cursor, text2); + free(text2); + } +} + static void _curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en) { @@ -1369,6 +1395,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v } else { + //yy evas_textblock_cursor_format_prepend(en->cursor, "\t"); _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); @@ -1420,6 +1447,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v if (en->have_selection) _range_del(en->cursor, rp->object, en); _sel_clear(en->cursor, rp->object, en); + //yy evas_textblock_cursor_format_prepend(en->cursor, "\n"); _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); @@ -1437,6 +1465,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v if (en->have_selection) _range_del(en->cursor, rp->object, en); _sel_clear(en->cursor, rp->object, en); + //zz evas_textblock_cursor_text_prepend(en->cursor, ev->string); _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); @@ -2068,6 +2097,7 @@ _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text) if (en->have_selection) _range_del(en->cursor, rp->object, en); _sel_clear(en->cursor, rp->object, en); + //xx evas_object_textblock_text_markup_prepend(en->cursor, text); _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); @@ -2220,17 +2250,17 @@ _edje_entry_item_geometry_get(Edje_Real_Part *rp, const char *item, Evas_Coord * Eina_List *l; Anchor *an; - if (!en) return 0; + if (!en) return EINA_FALSE; EINA_LIST_FOREACH(en->anchors, l, an) { if (an->item) continue; if (!strcmp(item, an->name)) { evas_textblock_cursor_format_item_geometry_get(an->start, cx, cy, cw, ch); - return 1; + return EINA_TRUE; } } - return 0; + return EINA_FALSE; } const Eina_List * @@ -2338,12 +2368,12 @@ _edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur) { Entry *en = rp->entry_data; Evas_Textblock_Cursor *c = _cursor_get(rp, cur); - if (!c) return 0; + if (!c) return EINA_FALSE; if (!evas_textblock_cursor_char_next(c)) { evas_textblock_cursor_eol_set(c, 0); if (evas_textblock_cursor_node_next(c)) goto ok; - else return 0; + else return EINA_FALSE; } ok: _curs_update_from_curs(c, rp->object, rp->entry_data); @@ -2360,7 +2390,7 @@ _edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur) _edje_emit(rp->edje, "cursor,changed", rp->part->name); _edje_entry_real_part_configure(rp); - return 1; + return EINA_TRUE; } Eina_Bool @@ -2368,11 +2398,11 @@ _edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur) { Entry *en = rp->entry_data; Evas_Textblock_Cursor *c = _cursor_get(rp, cur); - if (!c) return 0; + if (!c) return EINA_FALSE; if (!evas_textblock_cursor_char_prev(c)) { if (evas_textblock_cursor_node_prev(c)) goto ok; - else return 0; + else return EINA_FALSE; } ok: _curs_update_from_curs(c, rp->object, rp->entry_data); @@ -2389,7 +2419,7 @@ _edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur) _edje_emit(rp->edje, "cursor,changed", rp->part->name); _edje_entry_real_part_configure(rp); - return 1; + return EINA_TRUE; } Eina_Bool @@ -2399,13 +2429,13 @@ _edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur) Evas_Textblock_Cursor *c = _cursor_get(rp, cur); Evas_Coord lx, ly, lw, lh, cx, cy, cw, ch; int ln; - if (!c) return 0; + if (!c) return EINA_FALSE; ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL); ln--; - if (ln < 0) return 0; + if (ln < 0) return EINA_FALSE; if (!evas_object_textblock_line_number_geometry_get(rp->object, ln, &lx, &ly, &lw, &lh)) - return 0; + return EINA_FALSE; evas_textblock_cursor_char_geometry_get(c, &cx, &cy, &cw, &ch); if (!evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2))) { @@ -2428,7 +2458,7 @@ _edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur) _edje_emit(rp->edje, "cursor,changed", rp->part->name); _edje_entry_real_part_configure(rp); - return 1; + return EINA_TRUE; } Eina_Bool @@ -2438,12 +2468,12 @@ _edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur) Evas_Textblock_Cursor *c = _cursor_get(rp, cur); Evas_Coord lx, ly, lw, lh, cx, cy, cw, ch; int ln; - if (!c) return 0; + if (!c) return EINA_FALSE; ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL); ln++; if (!evas_object_textblock_line_number_geometry_get(rp->object, ln, &lx, &ly, &lw, &lh)) - return 0; + return EINA_FALSE; evas_textblock_cursor_char_geometry_get(c, &cx, &cy, &cw, &ch); if (!evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2))) { @@ -2466,7 +2496,7 @@ _edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur) _edje_emit(rp->edje, "cursor,changed", rp->part->name); _edje_entry_real_part_configure(rp); - return 1; + return EINA_TRUE; } void @@ -2498,8 +2528,7 @@ _edje_entry_cursor_end(Edje_Real_Part *rp, Edje_Cursor cur) Entry *en = rp->entry_data; Evas_Textblock_Cursor *c = _cursor_get(rp, cur); if (!c) return; - evas_textblock_cursor_node_last(c); - _curs_update_from_curs(c, rp->object, rp->entry_data); + _curs_end(c, rp->object, rp->entry_data); _sel_update(c, rp->object, rp->entry_data); #ifdef HAVE_ECORE_IMF @@ -2590,16 +2619,16 @@ Eina_Bool _edje_entry_cursor_is_format_get(Edje_Real_Part *rp, Edje_Cursor cur) { Evas_Textblock_Cursor *c = _cursor_get(rp, cur); - if (!c) return 0; - if (evas_textblock_cursor_node_format_get(c)) return 1; - return 0; + if (!c) return EINA_FALSE; + if (evas_textblock_cursor_node_format_get(c)) return EINA_TRUE; + return EINA_FALSE; } Eina_Bool _edje_entry_cursor_is_visible_format_get(Edje_Real_Part *rp, Edje_Cursor cur) { Evas_Textblock_Cursor *c = _cursor_get(rp, cur); - if (!c) return 0; + if (!c) return EINA_FALSE; return evas_textblock_cursor_node_format_is_visible_get(c); } @@ -2676,6 +2705,7 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event) en->have_composition = EINA_FALSE; } + //yy evas_textblock_cursor_text_prepend(en->cursor, ev->str); _curs_update_from_curs(en->cursor, rp->object, en); @@ -2729,7 +2759,8 @@ _edje_entry_imf_event_changed_cb(void *data, int type __UNUSED__, void *event) en->have_composition = EINA_TRUE; - evas_object_textblock_text_markup_prepend (en->cursor, preedit_string); + //xx + evas_object_textblock_text_markup_prepend(en->cursor, preedit_string); _sel_extend(en->cursor, rp->object, en); diff --git a/src/lib/edje_load.c b/src/lib/edje_load.c index 42cdcf7..3d5fdad 100644 --- a/src/lib/edje_load.c +++ b/src/lib/edje_load.c @@ -186,7 +186,7 @@ edje_file_group_exists(const char *file, const char *glob) Edje_File *edf; int error_ret = 0; - if ((!file) || (!*file)) return 0; + if ((!file) || (!*file)) return EINA_FALSE; edf = _edje_cache_file_coll_open(file, NULL, &error_ret, NULL); if (edf != NULL) { @@ -200,13 +200,13 @@ edje_file_group_exists(const char *file, const char *glob) { edje_match_patterns_free(patterns); _edje_cache_file_unref(edf); - return 1; + return EINA_TRUE; } edje_match_patterns_free(patterns); } _edje_cache_file_unref(edf); } - return 0; + return EINA_FALSE; } @@ -558,7 +558,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g _edje_ref(ed); _edje_block(ed); _edje_freeze(ed); - if (ed->collection->script) _edje_embryo_script_init(ed); +// if (ed->collection->script) _edje_embryo_script_init(ed); _edje_var_init(ed); for (i = 0; i < ed->table_parts_size; i++) { @@ -843,6 +843,10 @@ _edje_file_del(Edje *ed) _edje_block_violate(ed); _edje_var_shutdown(ed); _edje_programs_patterns_clean(ed); +// if (ed->collection) +// { +// if (ed->collection->script) _edje_embryo_script_shutdown(ed); +// } if (!((ed->file) && (ed->collection))) return; if (ed->table_parts) @@ -907,8 +911,14 @@ _edje_file_del(Edje *ed) /* Cleanup optional part. */ free(rp->drag); + free(rp->param1.set); + if (rp->param2) + free(rp->param2->set); eina_mempool_free(_edje_real_part_state_mp, rp->param2); + + if (rp->custom) + free(rp->custom->set); eina_mempool_free(_edje_real_part_state_mp, rp->custom); _edje_unref(rp->edje); @@ -984,7 +994,7 @@ static Eina_Bool data_cache_free(const Eina_Hash *hash __UNUSED__, const void *k edf = fdata; if (edf->free_strings) eina_stringshare_del(data); - return 1; + return EINA_TRUE; } void @@ -1106,6 +1116,7 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec) Edje_Program *pr; Edje_Part *ep; + _edje_embryo_script_shutdown(ec); EINA_LIST_FREE(ec->programs, pr) { Edje_Program_Target *prt; @@ -1208,7 +1219,7 @@ _edje_file_collection_hash_foreach(const Eina_Hash *hash __UNUSED__, const void coll->part, coll->references); _edje_collection_free(edf, coll); - return 1; + return EINA_TRUE; } #ifdef EDJE_PROGRAM_CACHE @@ -1216,7 +1227,7 @@ static Eina_Bool _edje_collection_free_prog_cache_matches_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata) { eina_list_free((Eina_List *)data); - return 1; + return EINA_TRUE; key = NULL; hash = NULL; fdata = NULL; diff --git a/src/lib/edje_lua.c b/src/lib/edje_lua.c index 685ef81..d0480fe 100644 --- a/src/lib/edje_lua.c +++ b/src/lib/edje_lua.c @@ -863,7 +863,7 @@ _edje_lua_timer_cb(void *data) return 0; } - res = luaL_checkint(L, -1); + res = luaL_optint(L, -1, ECORE_CALLBACK_CANCEL); lua_pop(L, 1); // -- res /* diff --git a/src/lib/edje_main.c b/src/lib/edje_main.c index dbbeb0d..b4539f7 100644 --- a/src/lib/edje_main.c +++ b/src/lib/edje_main.c @@ -6,13 +6,14 @@ #include "edje_private.h" +static Edje_Version _version = { VMAJ, VMIN, VMIC, VREV }; +EAPI Edje_Version *edje_version = &_version; + static int _edje_init_count = 0; int _edje_default_log_dom = -1; Eina_Mempool *_edje_real_part_mp = NULL; Eina_Mempool *_edje_real_part_state_mp = NULL; - - /*============================================================================* * API * *============================================================================*/ @@ -265,6 +266,15 @@ _edje_del(Edje *ed) if (tc->font) eina_stringshare_del(tc->font); free(tc); } + while (ed->text_insert_filter_callbacks) + { + Edje_Text_Insert_Filter_Callback *cb; + + cb = eina_list_data_get(ed->text_insert_filter_callbacks); + ed->text_insert_filter_callbacks = eina_list_remove(ed->text_insert_filter_callbacks, cb); + eina_stringshare_del(cb->part); + free(cb); + } free(ed); } diff --git a/src/lib/edje_message_queue.c b/src/lib/edje_message_queue.c index f207be3..6f8e86d 100644 --- a/src/lib/edje_message_queue.c +++ b/src/lib/edje_message_queue.c @@ -6,8 +6,9 @@ #include "edje_private.h" -static Ecore_Job *job = NULL; -static Ecore_Timer *job_loss_timer = NULL; +static int _injob = 0; +static Ecore_Job *_job = NULL; +static Ecore_Timer *_job_loss_timer = NULL; static Eina_List *msgq = NULL; static Eina_List *tmp_msgq = NULL; @@ -164,20 +165,25 @@ _edje_dummy_timer(void *data __UNUSED__) static void _edje_job(void *data __UNUSED__) { - if (job_loss_timer) + if (_job_loss_timer) { - ecore_timer_del(job_loss_timer); - job_loss_timer = NULL; + ecore_timer_del(_job_loss_timer); + _job_loss_timer = NULL; } + _job = NULL; + _injob++; _edje_message_queue_process(); - job = NULL; + _injob--; } static int _edje_job_loss_timer(void *data __UNUSED__) { - job_loss_timer = NULL; - if (job) job = NULL; + _job_loss_timer = NULL; + if (!_job) + { + _job = ecore_job_add(_edje_job, NULL); + } return 0; } @@ -190,10 +196,16 @@ void _edje_message_shutdown(void) { _edje_message_queue_clear(); - if (job_loss_timer) - ecore_timer_del(job_loss_timer); - job = NULL; - job_loss_timer = NULL; + if (_job_loss_timer) + { + ecore_timer_del(_job_loss_timer); + _job_loss_timer = NULL; + } + if (_job) + { + ecore_job_del(_job); + _job = NULL; + } } void @@ -340,14 +352,29 @@ _edje_message_send(Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, v int i; unsigned char *msg = NULL; - if (!job) - { - job = ecore_job_add(_edje_job, NULL); - if (job_loss_timer) ecore_timer_del(job_loss_timer); - job_loss_timer = ecore_timer_add(0.05, _edje_job_loss_timer, NULL); - } em = _edje_message_new(ed, queue, type, id); if (!em) return; + if (_job) + { + ecore_job_del(_job); + _job = NULL; + } + if (_injob > 0) + { + _job_loss_timer = ecore_timer_add(0.01, _edje_job_loss_timer, NULL); + } + else + { + if (!_job) + { + _job = ecore_job_add(_edje_job, NULL); + } + if (_job_loss_timer) + { + ecore_timer_del(_job_loss_timer); + _job_loss_timer = NULL; + } + } switch (em->type) { case EDJE_MESSAGE_NONE: @@ -368,6 +395,7 @@ _edje_message_send(Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id, v Edje_Message_String *emsg2, *emsg3; emsg2 = (Edje_Message_String *)emsg; + emsg3 = malloc(sizeof(Edje_Message_String)); emsg3->str = strdup(emsg2->str); msg = (unsigned char *)emsg3; diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index 46d0c99..11e8882 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -219,6 +219,8 @@ typedef struct _Edje_Font_Directory Edje_Font_Directory; typedef struct _Edje_Font_Directory_Entry Edje_Font_Directory_Entry; typedef struct _Edje_Image_Directory Edje_Image_Directory; typedef struct _Edje_Image_Directory_Entry Edje_Image_Directory_Entry; +typedef struct _Edje_Image_Directory_Set Edje_Image_Directory_Set; +typedef struct _Edje_Image_Directory_Set_Entry Edje_Image_Directory_Set_Entry; typedef struct _Edje_Spectrum_Directory Edje_Spectrum_Directory; typedef struct _Edje_Spectrum_Directory_Entry Edje_Spectrum_Directory_Entry; typedef struct _Edje_Program Edje_Program; @@ -399,6 +401,7 @@ struct _Edje_External_Directory_Entry struct _Edje_Image_Directory { Eina_List *entries; /* a list of Edje_Image_Directory_Entry */ + Eina_List *sets; /* a list of Edje_Image_Directory_Set */ }; struct _Edje_Image_Directory_Entry @@ -409,6 +412,27 @@ struct _Edje_Image_Directory_Entry int id; /* the id no. of the image */ }; +struct _Edje_Image_Directory_Set +{ + char *name; + Eina_List *entries; + + int id; +}; + +struct _Edje_Image_Directory_Set_Entry +{ + char *name; + int id; + + struct { + struct { + int w; + int h; + } min, max; + } size; +}; + /*----------*/ struct _Edje_Spectrum_Directory @@ -601,6 +625,7 @@ struct _Edje_Part struct _Edje_Part_Image_Id { int id; + Eina_Bool set; }; struct _Edje_Part_Description @@ -633,6 +658,7 @@ struct _Edje_Part_Description Eina_List *tween_list; /* list of Edje_Part_Image_Id */ int id; /* the image id to use */ int scale_hint; /* evas scale hint */ + Eina_Bool set; /* if image condition it's content */ } image; struct { @@ -744,6 +770,7 @@ struct _Edje_Part_Description typedef struct _Edje Edje; typedef struct _Edje_Real_Part_State Edje_Real_Part_State; typedef struct _Edje_Real_Part_Drag Edje_Real_Part_Drag; +typedef struct _Edje_Real_Part_Set Edje_Real_Part_Set; typedef struct _Edje_Real_Part Edje_Real_Part; typedef struct _Edje_Running_Program Edje_Running_Program; typedef struct _Edje_Signal_Callback Edje_Signal_Callback; @@ -762,6 +789,7 @@ typedef struct _Edje_Var_Animator Edje_Var_Animator; typedef struct _Edje_Var_Timer Edje_Var_Timer; typedef struct _Edje_Var_Pool Edje_Var_Pool; typedef struct _Edje_Signal_Source_Char Edje_Signal_Source_Char; +typedef struct _Edje_Text_Insert_Filter_Callback Edje_Text_Insert_Filter_Callback; struct _Edje_Signal_Source_Char { @@ -811,6 +839,7 @@ struct _Edje Edje_Program **table_programs; Edje_Real_Part *focused_part; Eina_List *subobjs; + Eina_List *text_insert_filter_callbacks; void *script_only_data; int table_programs_size; int table_parts_size; @@ -911,6 +940,14 @@ struct _Edje_Calc_Params unsigned char smooth : 1; // 1 }; // 96 +struct _Edje_Real_Part_Set +{ + Edje_Image_Directory_Set_Entry *entry; // 4 + Edje_Image_Directory_Set *set; // 4 + + int id; // 4 +}; + struct _Edje_Real_Part_State { Edje_Part_Description *description; // 4 @@ -923,8 +960,9 @@ struct _Edje_Real_Part_State Edje_Calc_Params p; // 96 #endif void *external_params; // 4 -}; // 24 -// WITH EDJE_CALC_CACHE 124 + Edje_Real_Part_Set *set; // 4 +}; // 28 +// WITH EDJE_CALC_CACHE 128 struct _Edje_Real_Part_Drag { @@ -1030,6 +1068,13 @@ struct _Edje_Signal_Callback unsigned char delete_me : 1; }; +struct _Edje_Text_Insert_Filter_Callback +{ + const char *part; + void (*func) (void *data, Evas_Object *obj, const char *part, char **text); + void *data; +}; + struct _Edje_Pending_Program { Edje *edje; @@ -1355,8 +1400,8 @@ Eina_Bool _edje_object_part_text_raw_set(Evas_Object *obj, Edje_Real_Par char *_edje_text_escape(const char *text); char *_edje_text_unescape(const char *text); -void _edje_embryo_script_init (Edje *ed); -void _edje_embryo_script_shutdown (Edje *ed); +void _edje_embryo_script_init (Edje_Part_Collection *edc); +void _edje_embryo_script_shutdown (Edje_Part_Collection *edc); void _edje_embryo_script_reset (Edje *ed); void _edje_embryo_test_run (Edje *ed, const char *fname, const char *sig, const char *src); Edje_Var *_edje_var_new (void); diff --git a/src/lib/edje_program.c b/src/lib/edje_program.c index 4004ad3..f1e7219 100644 --- a/src/lib/edje_program.c +++ b/src/lib/edje_program.c @@ -450,7 +450,7 @@ _edje_program_run_iterate(Edje_Running_Program *runp, double tim) Edje_Real_Part *rp; ed = runp->edje; - if (ed->delete_me) return 0; + if (ed->delete_me) return EINA_FALSE; _edje_block(ed); _edje_ref(ed); _edje_freeze(ed); @@ -523,14 +523,14 @@ _edje_program_run_iterate(Edje_Running_Program *runp, double tim) _edje_unref(ed); if (!ed->walking_actions) free(runp); _edje_unblock(ed); - return 0; + return EINA_FALSE; } break_prog: _edje_recalc(ed); _edje_thaw(ed); _edje_unref(ed); _edje_unblock(ed); - return 1; + return EINA_TRUE; } void diff --git a/src/lib/edje_script_only.c b/src/lib/edje_script_only.c index 7763ea8..3b1b916 100644 --- a/src/lib/edje_script_only.c +++ b/src/lib/edje_script_only.c @@ -197,7 +197,7 @@ _oid_freeall_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, vo evas_object_del(oid->obj); free(oid); - return 1; + return EINA_TRUE; } static void @@ -217,7 +217,7 @@ _oid_moveall_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, vo Oid *oid = data; evas_object_move(oid->obj, oid->ed->x + oid->x, oid->ed->y + oid->y); - return 1; + return EINA_TRUE; } static void diff --git a/src/lib/edje_util.c b/src/lib/edje_util.c index 57d59cd..21fd78c 100644 --- a/src/lib/edje_util.c +++ b/src/lib/edje_util.c @@ -1100,10 +1100,10 @@ edje_object_part_exists(const Evas_Object *obj, const char *part) Edje_Real_Part *rp; ed = _edje_fetch(obj); - if ((!ed) || (!part)) return 0; + if ((!ed) || (!part)) return EINA_FALSE; rp = _edje_real_part_recursive_get(ed, (char *)part); - if (!rp) return 0; - return 1; + if (!rp) return EINA_FALSE; + return EINA_TRUE; } /** @@ -1189,6 +1189,27 @@ edje_object_part_geometry_get(const Evas_Object *obj, const char *part, Evas_Coo return EINA_TRUE; } +/** + * @brief Set the function that provides item objects for named items in an edje entry text + * + * @param obj A valid Evas Object handle + * @param func The function to call (or NULL to disable) to get item objects + * @param data The data pointer to pass to the @p func callback + * + * Item objects may be deleted any time by Edje, and will be deleted when the + * Edje object is deleted (or file is set to a new file). + */ +EAPI void +edje_object_item_provider_set(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *obj, const char *part, const char *item), void *data) +{ + Edje *ed; + + ed = _edje_fetch(obj); + if (!ed) return; + ed->item_provider.func = func; + ed->item_provider.data = data; +} + /* FIXDOC: New Function */ /** * @brief Set the object text callback. @@ -1604,27 +1625,6 @@ edje_object_part_text_insert(Evas_Object *obj, const char *part, const char *tex } /** - * @brief Set the function that provides item objects for named items in an edje entry text - * - * @param obj A valid Evas Object handle - * @param func The function to call (or NULL to disable) to get item objects - * @param data The data pointer to pass to the @p func callback - * - * Item objects may be deleted any time by Edje, and will be deleted when the - * Edje object is deleted (or file is set to a new file). - */ -EAPI void -edje_object_item_provider_set(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *obj, const char *part, const char *item), void *data) -{ - Edje *ed; - - ed = _edje_fetch(obj); - if (!ed) return; - ed->item_provider.func = func; - ed->item_provider.data = data; -} - -/** * @brief Return a list of char anchor names. * * @param obj A valid Evas_Object handle @@ -1729,12 +1729,12 @@ edje_object_part_text_item_geometry_get(const Evas_Object *obj, const char *part Edje_Real_Part *rp; ed = _edje_fetch(obj); - if ((!ed) || (!part)) return 0; + if ((!ed) || (!part)) return EINA_FALSE; rp = _edje_real_part_recursive_get(ed, (char *)part); - if (!rp) return 0; + if (!rp) return EINA_FALSE; if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) return _edje_entry_item_geometry_get(rp, item, cx, cy, cw, ch); - return 0; + return EINA_FALSE; } /** @@ -1867,14 +1867,14 @@ edje_object_part_text_cursor_next(const Evas_Object *obj, const char *part, Edje Edje_Real_Part *rp; ed = _edje_fetch(obj); - if ((!ed) || (!part)) return 0; + if ((!ed) || (!part)) return EINA_FALSE; rp = _edje_real_part_recursive_get(ed, (char *)part); - if (!rp) return 0; + if (!rp) return EINA_FALSE; if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) { return _edje_entry_cursor_next(rp, cur); } - return 0; + return EINA_FALSE; } /** @@ -1890,14 +1890,14 @@ edje_object_part_text_cursor_prev(const Evas_Object *obj, const char *part, Edje Edje_Real_Part *rp; ed = _edje_fetch(obj); - if ((!ed) || (!part)) return 0; + if ((!ed) || (!part)) return EINA_FALSE; rp = _edje_real_part_recursive_get(ed, (char *)part); - if (!rp) return 0; + if (!rp) return EINA_FALSE; if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) { return _edje_entry_cursor_prev(rp, cur); } - return 0; + return EINA_FALSE; } /** @@ -1913,14 +1913,14 @@ edje_object_part_text_cursor_up(const Evas_Object *obj, const char *part, Edje_C Edje_Real_Part *rp; ed = _edje_fetch(obj); - if ((!ed) || (!part)) return 0; + if ((!ed) || (!part)) return EINA_FALSE; rp = _edje_real_part_recursive_get(ed, (char *)part); - if (!rp) return 0; + if (!rp) return EINA_FALSE; if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) { return _edje_entry_cursor_up(rp, cur); } - return 0; + return EINA_FALSE; } /** @@ -1936,14 +1936,14 @@ edje_object_part_text_cursor_down(const Evas_Object *obj, const char *part, Edje Edje_Real_Part *rp; ed = _edje_fetch(obj); - if ((!ed) || (!part)) return 0; + if ((!ed) || (!part)) return EINA_FALSE; rp = _edje_real_part_recursive_get(ed, (char *)part); - if (!rp) return 0; + if (!rp) return EINA_FALSE; if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) { return _edje_entry_cursor_down(rp, cur); } - return 0; + return EINA_FALSE; } /** @@ -2069,14 +2069,14 @@ edje_object_part_text_cursor_is_format_get(const Evas_Object *obj, const char *p Edje_Real_Part *rp; ed = _edje_fetch(obj); - if ((!ed) || (!part)) return 0; + if ((!ed) || (!part)) return EINA_FALSE; rp = _edje_real_part_recursive_get(ed, (char *)part); - if (!rp) return 0; + if (!rp) return EINA_FALSE; if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) { return _edje_entry_cursor_is_format_get(rp, cur); } - return 0; + return EINA_FALSE; } /** @@ -2125,6 +2125,44 @@ edje_object_part_text_cursor_content_get(const Evas_Object *obj, const char *par return NULL; } +EAPI void +edje_object_text_insert_filter_callback_add(Evas_Object *obj, const char *part, void (*func) (void *data, Evas_Object *obj, const char *part, char **text), const void *data) +{ + Edje *ed; + Edje_Text_Insert_Filter_Callback *cb; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + cb = calloc(1, sizeof(Edje_Text_Insert_Filter_Callback)); + cb->part = eina_stringshare_add(part); + cb->func = func; + cb->data = (void*) data; + ed->text_insert_filter_callbacks = + eina_list_append(ed->text_insert_filter_callbacks, cb); +} + +EAPI void +edje_object_text_insert_filter_callback_del(Evas_Object *obj, const char *part, void (*func) (void *data, Evas_Object *obj, const char *part, char **text), const void *data) +{ + Edje *ed; + Edje_Text_Insert_Filter_Callback *cb; + Eina_List *l; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb) + { + if ((!strcmp(cb->part, part)) && (cb->func == func) && (cb->data == data)) + { + ed->text_insert_filter_callbacks = + eina_list_remove_list(ed->text_insert_filter_callbacks, l); + eina_stringshare_del(cb->part); + free(cb); + return; + } + } +} + /** * @brief Swallows an object into the edje. * @@ -3896,14 +3934,6 @@ edje_object_part_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear return EINA_TRUE; } - - - - - - - - static void _edje_perspective_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info) { @@ -4026,7 +4056,7 @@ edje_perspective_global_set(Edje_Perspective *ps, Eina_Bool global) EAPI Eina_Bool edje_perspective_global_get(const Edje_Perspective *ps) { - if (!ps) return 0; + if (!ps) return EINA_FALSE; return ps->global; } @@ -4070,9 +4100,6 @@ edje_object_perspective_get(const Evas_Object *obj) return ed->persp; } - - - #define EDJE_PRELOAD_EMISSION "preload,done" #define EDJE_PRELOAD_SOURCE NULL |