summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2011-02-01 13:26:49 +0000
committerTom Hacohen <tom@stosb.com>2011-02-01 13:26:49 +0000
commit5e33a75553ff68bfc917eff7c8cfb70861e27200 (patch)
tree8b47a20ff3cf2d317faa983da4a797c10197e5a3 /legacy
parent6e7b0dffd70c8dcb1e754e714b8cd37cc040ef28 (diff)
Edje: Added mirrored mode. Mirrored mode is used for UI-mirroring. It lets you mirror edje objects automatically (it also sends signals to the .edc code so you can do tweaks if you want), no need to create a special theme just for rtl layouts.
This is controlled by the two added API functions. The changes in Elementary that utilize these functions will be committed soon. SVN revision: 56635
Diffstat (limited to 'legacy')
-rw-r--r--legacy/edje/AUTHORS2
-rw-r--r--legacy/edje/src/bin/edje_cc_handlers.c31
-rw-r--r--legacy/edje/src/lib/Edje.h2
-rw-r--r--legacy/edje/src/lib/edje_cache.c29
-rw-r--r--legacy/edje/src/lib/edje_calc.c159
-rw-r--r--legacy/edje/src/lib/edje_data.c1
-rw-r--r--legacy/edje/src/lib/edje_load.c26
-rw-r--r--legacy/edje/src/lib/edje_private.h50
-rw-r--r--legacy/edje/src/lib/edje_smart.c9
-rw-r--r--legacy/edje/src/lib/edje_util.c67
10 files changed, 334 insertions, 42 deletions
diff --git a/legacy/edje/AUTHORS b/legacy/edje/AUTHORS
index fde96ed7bb..9a636b3d6a 100644
--- a/legacy/edje/AUTHORS
+++ b/legacy/edje/AUTHORS
@@ -12,3 +12,5 @@ Jihoon Kim <jihoon48.kim@samsung.com>
12Tiago Falcão <tiago@profusion.mobi> 12Tiago Falcão <tiago@profusion.mobi>
13Davide Andreoli <dave@gurumeditation.it> 13Davide Andreoli <dave@gurumeditation.it>
14Sebastian Dransfeld <sd@tango.flipp.net> 14Sebastian Dransfeld <sd@tango.flipp.net>
15Tom Hacohen <tom@stosb.com>
16Aharon Hillel <a.hillel@partner.samsung.com>
diff --git a/legacy/edje/src/bin/edje_cc_handlers.c b/legacy/edje/src/bin/edje_cc_handlers.c
index 45a22f6b7d..33c963d8ae 100644
--- a/legacy/edje/src/bin/edje_cc_handlers.c
+++ b/legacy/edje/src/bin/edje_cc_handlers.c
@@ -102,6 +102,7 @@ static void st_collections_group_alias(void);
102static void st_collections_group_min(void); 102static void st_collections_group_min(void);
103static void st_collections_group_max(void); 103static void st_collections_group_max(void);
104static void st_collections_group_data_item(void); 104static void st_collections_group_data_item(void);
105static void st_collections_group_orientation(void);
105 106
106static void ob_collections_group_script(void); 107static void ob_collections_group_script(void);
107static void ob_collections_group_lua_script(void); 108static void ob_collections_group_lua_script(void);
@@ -290,6 +291,7 @@ New_Statement_Handler statement_handlers[] =
290 {"collections.group.alias", st_collections_group_alias}, 291 {"collections.group.alias", st_collections_group_alias},
291 {"collections.group.min", st_collections_group_min}, 292 {"collections.group.min", st_collections_group_min},
292 {"collections.group.max", st_collections_group_max}, 293 {"collections.group.max", st_collections_group_max},
294 {"collections.group.orientation", st_collections_group_orientation},
293 {"collections.group.data.item", st_collections_group_data_item}, 295 {"collections.group.data.item", st_collections_group_data_item},
294 {"collections.group.externals.external", st_externals_external}, /* dup */ 296 {"collections.group.externals.external", st_externals_external}, /* dup */
295 {"collections.group.image", st_images_image}, /* dup */ 297 {"collections.group.image", st_images_image}, /* dup */
@@ -2000,6 +2002,35 @@ st_collections_group_data_item(void)
2000 2002
2001/** 2003/**
2002 @page edcref 2004 @page edcref
2005 @property
2006 orientation
2007 @parameters
2008 enum AUTO, LTR, RTL
2009 @effect
2010 This defines GROUP orientation.
2011 This is useful if you want match interface orientation with language.
2012 AUTO - Follow system defs.
2013 LTR - suitable for Left To Right Languages (latin)
2014 RTL - suitable for Right To Left Languages (Hebrew, Arabic interface)
2015 @endproperty
2016*/
2017static void
2018st_collections_group_orientation(void)
2019{
2020 Edje_Part_Collection *pc;
2021
2022 check_arg_count(1);
2023
2024 pc = eina_list_data_get(eina_list_last(edje_collections));
2025 pc->prop.orientation = parse_enum(0,
2026 "AUTO", EDJE_ORIENTATION_AUTO,
2027 "LTR", EDJE_ORIENTATION_LTR,
2028 "RTL", EDJE_ORIENTATION_RTL,
2029 NULL);
2030}
2031
2032/**
2033 @page edcref
2003 @block 2034 @block
2004 parts 2035 parts
2005 @context 2036 @context
diff --git a/legacy/edje/src/lib/Edje.h b/legacy/edje/src/lib/Edje.h
index 419b0160d5..afabab02ca 100644
--- a/legacy/edje/src/lib/Edje.h
+++ b/legacy/edje/src/lib/Edje.h
@@ -502,6 +502,8 @@ typedef Evas_Object *(*Edje_Item_Provider_Cb) (void *data, Evas_Object *obj, c
502 EAPI double edje_scale_get (void); 502 EAPI double edje_scale_get (void);
503 EAPI Eina_Bool edje_object_scale_set (Evas_Object *obj, double scale); 503 EAPI Eina_Bool edje_object_scale_set (Evas_Object *obj, double scale);
504 EAPI double edje_object_scale_get (const Evas_Object *obj); 504 EAPI double edje_object_scale_get (const Evas_Object *obj);
505 EAPI void edje_object_mirrored_set (Evas_Object *obj, Eina_Bool rtl);
506 EAPI Eina_Bool edje_object_mirrored_get (const Evas_Object *obj);
505 507
506 /* edje_load.c */ 508 /* edje_load.c */
507 EAPI Eina_List *edje_file_collection_list (const char *file); 509 EAPI Eina_List *edje_file_collection_list (const char *file);
diff --git a/legacy/edje/src/lib/edje_cache.c b/legacy/edje/src/lib/edje_cache.c
index b2a0f8c1ca..6368ba0812 100644
--- a/legacy/edje/src/lib/edje_cache.c
+++ b/legacy/edje/src/lib/edje_cache.c
@@ -46,21 +46,26 @@ _edje_file_coll_open(Edje_File *edf, const char *coll)
46 id = ce->id; 46 id = ce->id;
47 if (id < 0) return NULL; 47 if (id < 0) return NULL;
48 48
49#define INIT_EMP(Tp, Sz, Ce) \ 49#define INIT_EMP(Tp, Sz, Ce) \
50 buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \ 50 buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \
51 sprintf(buffer, "%s/%s", ce->entry, #Tp); \ 51 sprintf(buffer, "%s/%s", ce->entry, #Tp); \
52 Ce->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp); \ 52 Ce->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp); \
53 _emp_##Tp = Ce->mp.Tp; 53 _emp_##Tp = Ce->mp.Tp;
54 54
55 INIT_EMP(RECTANGLE, Edje_Part_Description_Common, ce); 55#define INIT_EMP_BOTH(Tp, Sz, Ce) \
56 INIT_EMP(TEXT, Edje_Part_Description_Text, ce); 56 INIT_EMP(Tp, Sz, Ce) \
57 INIT_EMP(IMAGE, Edje_Part_Description_Image, ce); 57 Ce->mp_rtl.Tp = eina_mempool_add("one_big", buffer, NULL, \
58 INIT_EMP(SWALLOW, Edje_Part_Description_Common, ce); 58 sizeof (Sz), Ce->count.Tp);
59 INIT_EMP(TEXTBLOCK, Edje_Part_Description_Text, ce); 59
60 INIT_EMP(GROUP, Edje_Part_Description_Common, ce); 60 INIT_EMP_BOTH(RECTANGLE, Edje_Part_Description_Common, ce);
61 INIT_EMP(BOX, Edje_Part_Description_Box, ce); 61 INIT_EMP_BOTH(TEXT, Edje_Part_Description_Text, ce);
62 INIT_EMP(TABLE, Edje_Part_Description_Table, ce); 62 INIT_EMP_BOTH(IMAGE, Edje_Part_Description_Image, ce);
63 INIT_EMP(EXTERNAL, Edje_Part_Description_External, ce); 63 INIT_EMP_BOTH(SWALLOW, Edje_Part_Description_Common, ce);
64 INIT_EMP_BOTH(TEXTBLOCK, Edje_Part_Description_Text, ce);
65 INIT_EMP_BOTH(GROUP, Edje_Part_Description_Common, ce);
66 INIT_EMP_BOTH(BOX, Edje_Part_Description_Box, ce);
67 INIT_EMP_BOTH(TABLE, Edje_Part_Description_Table, ce);
68 INIT_EMP_BOTH(EXTERNAL, Edje_Part_Description_External, ce);
64 INIT_EMP(part, Edje_Part, ce); 69 INIT_EMP(part, Edje_Part, ce);
65 70
66 snprintf(buf, sizeof(buf), "edje/collections/%i", id); 71 snprintf(buf, sizeof(buf), "edje/collections/%i", id);
diff --git a/legacy/edje/src/lib/edje_calc.c b/legacy/edje/src/lib/edje_calc.c
index 05646a7a86..53582171ef 100644
--- a/legacy/edje/src/lib/edje_calc.c
+++ b/legacy/edje/src/lib/edje_calc.c
@@ -5,6 +5,9 @@
5#define FLAG_Y 0x02 5#define FLAG_Y 0x02
6#define FLAG_XY (FLAG_X | FLAG_Y) 6#define FLAG_XY (FLAG_X | FLAG_Y)
7 7
8static void _edje_part_make_rtl(Edje_Part_Description_Common *desc);
9static Edje_Part_Description_Common *_edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type);
10
8static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep, 11static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep,
9 Edje_Part_Description_Common *desc, Edje_Part_Description_Common *chosen_desc, 12 Edje_Part_Description_Common *desc, Edje_Part_Description_Common *chosen_desc,
10 Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y, 13 Edje_Real_Part *rel1_to_x, Edje_Real_Part *rel1_to_y,
@@ -60,31 +63,172 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos)
60#endif 63#endif
61} 64}
62 65
66
67/**
68 * Returns part description
69 *
70 * @internal
71 *
72 * Converts part description to RTL-desc.
73 *
74 * @param desc Pointer to desc buffer.
75 *
76 **/
77static void
78_edje_part_make_rtl(Edje_Part_Description_Common *desc)
79{
80 double t;
81 int i;
82
83 if(!desc)
84 return;
85
86 /* This makes alignment right-oriented */
87 desc->align.x = 1.0 - desc->align.x;
88
89 /* same as above for relative components */
90 t = desc->rel1.relative_x;
91 desc->rel1.relative_x = 1.0 - desc->rel2.relative_x;
92 desc->rel2.relative_x = 1.0 - t;
93
94 /* +1 and +1 are because how edje works with right
95 * side borders - nothing is printed beyond that limit
96 *
97 * rel2 is now to the left of rel1, and Edje assumes
98 * the opposite so we switch corners on x-axis to define
99 * offset from right to left */
100 i = desc->rel1.offset_x;
101 desc->rel1.offset_x = -(desc->rel2.offset_x + 1);
102 desc->rel2.offset_x = -(i + 1);
103
104 i = desc->rel1.id_x;
105 desc->rel1.id_x = desc->rel2.id_x;
106 desc->rel2.id_x = i;
107}
108
109/**
110 * Returns part description
111 *
112 * @internal
113 *
114 * Returns part description according to object orientation.
115 * When object is in RTL-orientation (RTL flag is set)
116 * this returns the RTL-desc of it.
117 * RTL-desc would be allocated if was not created by a previous call.
118 * The dst pointer is updated in case of an allocation.
119 *
120 * @param ed Edje object.
121 * @param src The Left To Right (LTR), original desc.
122 * @param dst Pointer to Right To Left (RTL) desc-list.
123 * @param type name of dec type. Example: "default".
124 *
125 * @return Edje part description.
126 *
127 **/
128static Edje_Part_Description_Common *
129_edje_get_description_by_orientation(Edje *ed, Edje_Part_Description_Common *src, Edje_Part_Description_Common **dst, unsigned char type)
130{
131 Edje_Part_Description_Common *desc_rtl = NULL;
132 Edje_Part_Collection_Directory_Entry *ce;
133 size_t memsize = 0;
134
135 /* RTL flag is not set, return original description */
136 if(!edje_object_mirrored_get(ed->obj))
137 return src;
138
139 if(*dst)
140 return *dst; /* Was allocated before and we should use it */
141
142#define EDIT_ALLOC_POOL_RTL(Short, Type, Name) \
143 case EDJE_PART_TYPE_##Short: \
144 { \
145 Edje_Part_Description_##Type *Name; \
146 Name = eina_mempool_malloc(ce->mp_rtl.Short, \
147 sizeof (Edje_Part_Description_##Type)); \
148 memset(Name, 0, sizeof(Edje_Part_Description_##Type)); \
149 desc_rtl = &Name->common; \
150 memsize = sizeof(Edje_Part_Description_##Type); \
151 break; \
152 }
153
154 ce = eina_hash_find(ed->file->collection, ed->group);
155
156 switch (type)
157 {
158 case EDJE_PART_TYPE_RECTANGLE:
159 desc_rtl = eina_mempool_malloc(ce->mp_rtl.RECTANGLE,
160 sizeof (Edje_Part_Description_Common));
161 ce->count.RECTANGLE++;
162 memsize = sizeof(Edje_Part_Description_Common);
163 break;
164 case EDJE_PART_TYPE_SWALLOW:
165 desc_rtl = eina_mempool_malloc(ce->mp_rtl.SWALLOW,
166 sizeof (Edje_Part_Description_Common));
167 ce->count.SWALLOW++;
168 memsize = sizeof(Edje_Part_Description_Common);
169 break;
170 case EDJE_PART_TYPE_GROUP:
171 desc_rtl = eina_mempool_malloc(ce->mp_rtl.GROUP,
172 sizeof (Edje_Part_Description_Common));
173 ce->count.GROUP++;
174 memsize = sizeof(Edje_Part_Description_Common);
175 break;
176 EDIT_ALLOC_POOL_RTL(TEXT, Text, text);
177 EDIT_ALLOC_POOL_RTL(TEXTBLOCK, Text, text);
178 EDIT_ALLOC_POOL_RTL(IMAGE, Image, image);
179 EDIT_ALLOC_POOL_RTL(BOX, Box, box);
180 EDIT_ALLOC_POOL_RTL(TABLE, Table, table);
181 EDIT_ALLOC_POOL_RTL(EXTERNAL, External, external_params);
182 }
183
184 if(desc_rtl)
185 memcpy(desc_rtl, src, memsize);
186
187 _edje_part_make_rtl(desc_rtl);
188
189 *dst = desc_rtl;
190 return desc_rtl;
191}
192
63Edje_Part_Description_Common * 193Edje_Part_Description_Common *
64_edje_part_description_find(Edje *ed __UNUSED__, Edje_Real_Part *rp, const char *name, 194_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name,
65 double val) 195 double val)
66{ 196{
67 Edje_Part *ep = rp->part; 197 Edje_Part *ep = rp->part;
68 Edje_Part_Description_Common *ret = NULL; 198 Edje_Part_Description_Common *ret = NULL;
69 Edje_Part_Description_Common *d; 199 Edje_Part_Description_Common *d;
200
70 double min_dst = 99999.0; 201 double min_dst = 99999.0;
71 unsigned int i; 202 unsigned int i;
72 203
204 /* RTL flag is set, return RTL description */
205 if(edje_object_mirrored_get(ed->obj))
206 if(!ep->other.desc_rtl)
207 ep->other.desc_rtl = (Edje_Part_Description_Common **)
208 calloc(ep->other.desc_count,
209 sizeof (Edje_Part_Description_Common *));
210
73 if (!strcmp(name, "default") && val == 0.0) 211 if (!strcmp(name, "default") && val == 0.0)
74 return ep->default_desc; 212 return _edje_get_description_by_orientation(ed,
213 ep->default_desc, &ep->default_desc_rtl, ep->type);
75 214
76 if (!strcmp(name, "custom")) 215 if (!strcmp(name, "custom"))
77 return rp->custom ? rp->custom->description : NULL; 216 return rp->custom ?
217 _edje_get_description_by_orientation(ed, rp->custom->description,
218 &rp->custom->description_rtl, ep->type) : NULL;
78 219
79 if (!strcmp(name, "default")) 220 if (!strcmp(name, "default"))
80 { 221 {
81 ret = ep->default_desc; 222 ret = _edje_get_description_by_orientation(ed, ep->default_desc,
223 &ep->default_desc_rtl, ep->type);
224
82 min_dst = ABS(ep->default_desc->state.value - val); 225 min_dst = ABS(ep->default_desc->state.value - val);
83 } 226 }
227
84 for (i = 0; i < ep->other.desc_count; ++i) 228 for (i = 0; i < ep->other.desc_count; ++i)
85 { 229 {
86 d = ep->other.desc[i]; 230 d = ep->other.desc[i];
87 231
88 if (d->state.name && !strcmp(d->state.name, name)) 232 if (d->state.name && !strcmp(d->state.name, name))
89 { 233 {
90 double dst; 234 double dst;
@@ -92,7 +236,8 @@ _edje_part_description_find(Edje *ed __UNUSED__, Edje_Real_Part *rp, const char
92 dst = ABS(d->state.value - val); 236 dst = ABS(d->state.value - val);
93 if (dst < min_dst) 237 if (dst < min_dst)
94 { 238 {
95 ret = d; 239 ret = _edje_get_description_by_orientation(ed, d,
240 &ep->other.desc_rtl[i], ep->type);
96 min_dst = dst; 241 min_dst = dst;
97 } 242 }
98 } 243 }
@@ -265,7 +410,7 @@ _edje_recalc_do(Edje *ed)
265 410
266 ep = ed->table_parts[i]; 411 ep = ed->table_parts[i];
267 if (ep->calculated != FLAG_XY) 412 if (ep->calculated != FLAG_XY)
268 _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY); 413 _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY);
269 } 414 }
270 if (!ed->calc_only) ed->recalc = 0; 415 if (!ed->calc_only) ed->recalc = 0;
271#ifdef EDJE_CALC_CACHE 416#ifdef EDJE_CALC_CACHE
diff --git a/legacy/edje/src/lib/edje_data.c b/legacy/edje/src/lib/edje_data.c
index 2c80933002..b10c98839b 100644
--- a/legacy/edje/src/lib/edje_data.c
+++ b/legacy/edje/src/lib/edje_data.c
@@ -785,4 +785,5 @@ _edje_edd_init(void)
785 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "part", part, EET_T_STRING); 785 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "part", part, EET_T_STRING);
786 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "script_only", script_only, EET_T_UCHAR); 786 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "script_only", script_only, EET_T_UCHAR);
787 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "lua_script_only", lua_script_only, EET_T_UCHAR); 787 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "lua_script_only", lua_script_only, EET_T_UCHAR);
788 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_collection, Edje_Part_Collection, "prop.orientation", prop.orientation, EET_T_INT);
788} 789}
diff --git a/legacy/edje/src/lib/edje_load.c b/legacy/edje/src/lib/edje_load.c
index a75ed496ca..5edb012463 100644
--- a/legacy/edje/src/lib/edje_load.c
+++ b/legacy/edje/src/lib/edje_load.c
@@ -25,12 +25,15 @@ static Eina_List *_edje_swallows_collect(Edje *ed);
25EAPI Eina_Bool 25EAPI Eina_Bool
26edje_object_file_set(Evas_Object *obj, const char *file, const char *group) 26edje_object_file_set(Evas_Object *obj, const char *file, const char *group)
27{ 27{
28 Eina_Bool ret;
28 Edje *ed; 29 Edje *ed;
29 30
30 ed = _edje_fetch(obj); 31 ed = _edje_fetch(obj);
31 if (!ed) 32 if (!ed)
32 return EINA_FALSE; 33 return EINA_FALSE;
33 return ed->api->file_set(obj, file, group); 34 ret = ed->api->file_set(obj, file, group);
35 _edje_object_orientation_inform(obj);
36 return ret;
34} 37}
35 38
36/* FIXDOC: Verify/expand doc. */ 39/* FIXDOC: Verify/expand doc. */
@@ -373,6 +376,10 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
373 376
374 if (ed->collection) 377 if (ed->collection)
375 { 378 {
379 if (ed->collection->prop.orientation != EDJE_ORIENTATION_AUTO)
380 ed->is_rtl = (ed->collection->prop.orientation ==
381 EDJE_ORIENTATION_RTL);
382
376 if (ed->collection->script_only) 383 if (ed->collection->script_only)
377 { 384 {
378 ed->load_error = EDJE_LOAD_ERROR_NONE; 385 ed->load_error = EDJE_LOAD_ERROR_NONE;
@@ -446,7 +453,8 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
446 _edje_ref(rp->edje); 453 _edje_ref(rp->edje);
447 rp->part = ep; 454 rp->part = ep;
448 parts = eina_list_append(parts, rp); 455 parts = eina_list_append(parts, rp);
449 rp->param1.description = ep->default_desc; 456 rp->param1.description = _edje_part_description_find(ed,
457 rp, "default", 0.0);
450 rp->chosen_description = rp->param1.description; 458 rp->chosen_description = rp->param1.description;
451 if (!rp->param1.description) 459 if (!rp->param1.description)
452 ERR("no default part description!"); 460 ERR("no default part description!");
@@ -1204,6 +1212,10 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collec
1204 _edje_collection_free_part_description_clean(ep->type, ep->other.desc[j], edf->free_strings); 1212 _edje_collection_free_part_description_clean(ep->type, ep->other.desc[j], edf->free_strings);
1205 1213
1206 free(ep->other.desc); 1214 free(ep->other.desc);
1215 /* Alloc for RTL objects in edje_calc.c:_edje_part_description_find() */
1216 if(ep->other.desc_rtl)
1217 free(ep->other.desc_rtl);
1218
1207 free(ep->items); 1219 free(ep->items);
1208// technically need this - but we ASSUME we use "one_big" so everything gets 1220// technically need this - but we ASSUME we use "one_big" so everything gets
1209// freed in one go lower down when we del the mempool... but what if pool goes 1221// freed in one go lower down when we del the mempool... but what if pool goes
@@ -1251,6 +1263,16 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collec
1251 eina_mempool_del(ce->mp.part); 1263 eina_mempool_del(ce->mp.part);
1252 memset(&ce->mp, 0, sizeof (ce->mp)); 1264 memset(&ce->mp, 0, sizeof (ce->mp));
1253 1265
1266 eina_mempool_del(ce->mp_rtl.RECTANGLE);
1267 eina_mempool_del(ce->mp_rtl.TEXT);
1268 eina_mempool_del(ce->mp_rtl.IMAGE);
1269 eina_mempool_del(ce->mp_rtl.SWALLOW);
1270 eina_mempool_del(ce->mp_rtl.TEXTBLOCK);
1271 eina_mempool_del(ce->mp_rtl.GROUP);
1272 eina_mempool_del(ce->mp_rtl.BOX);
1273 eina_mempool_del(ce->mp_rtl.TABLE);
1274 eina_mempool_del(ce->mp_rtl.EXTERNAL);
1275 memset(&ce->mp_rtl, 0, sizeof (ce->mp_rtl));
1254 free(ec); 1276 free(ec);
1255 ce->ref = NULL; 1277 ce->ref = NULL;
1256} 1278}
diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h
index a914f21a28..528f3fd7dd 100644
--- a/legacy/edje/src/lib/edje_private.h
+++ b/legacy/edje/src/lib/edje_private.h
@@ -365,6 +365,10 @@ typedef struct _Edje_Part_Box_Animation Edje_Part_Box_Animation;
365#define EDJE_ENTRY_CURSOR_MODE_UNDER 0 365#define EDJE_ENTRY_CURSOR_MODE_UNDER 0
366#define EDJE_ENTRY_CURSOR_MODE_BEFORE 1 366#define EDJE_ENTRY_CURSOR_MODE_BEFORE 1
367 367
368#define EDJE_ORIENTATION_AUTO 0
369#define EDJE_ORIENTATION_LTR 1
370#define EDJE_ORIENTATION_RTL 2
371
368#define EDJE_PART_PATH_SEPARATOR ':' 372#define EDJE_PART_PATH_SEPARATOR ':'
369#define EDJE_PART_PATH_SEPARATOR_STRING ":" 373#define EDJE_PART_PATH_SEPARATOR_STRING ":"
370#define EDJE_PART_PATH_SEPARATOR_INDEXL '[' 374#define EDJE_PART_PATH_SEPARATOR_INDEXL '['
@@ -543,6 +547,16 @@ struct _Edje_Program_After /* the action to run after another action */
543}; 547};
544 548
545/*----------*/ 549/*----------*/
550#define PART_TYPE_FIELDS(TYPE) \
551 TYPE RECTANGLE; \
552 TYPE TEXT; \
553 TYPE IMAGE; \
554 TYPE SWALLOW; \
555 TYPE TEXTBLOCK; \
556 TYPE GROUP; \
557 TYPE BOX; \
558 TYPE TABLE; \
559 TYPE EXTERNAL;
546 560
547struct _Edje_Part_Collection_Directory_Entry 561struct _Edje_Part_Collection_Directory_Entry
548{ 562{
@@ -551,32 +565,21 @@ struct _Edje_Part_Collection_Directory_Entry
551 565
552 struct 566 struct
553 { 567 {
554 int RECTANGLE; 568 PART_TYPE_FIELDS(int)
555 int TEXT;
556 int IMAGE;
557 int SWALLOW;
558 int TEXTBLOCK;
559 int GROUP;
560 int BOX;
561 int TABLE;
562 int EXTERNAL;
563 int part; 569 int part;
564 } count; 570 } count;
565 571
566 struct 572 struct
567 { 573 {
568 Eina_Mempool *RECTANGLE; 574 PART_TYPE_FIELDS(Eina_Mempool *)
569 Eina_Mempool *TEXT;
570 Eina_Mempool *IMAGE;
571 Eina_Mempool *SWALLOW;
572 Eina_Mempool *TEXTBLOCK;
573 Eina_Mempool *GROUP;
574 Eina_Mempool *BOX;
575 Eina_Mempool *TABLE;
576 Eina_Mempool *EXTERNAL;
577 Eina_Mempool *part; 575 Eina_Mempool *part;
578 } mp; 576 } mp;
579 577
578 struct
579 {
580 PART_TYPE_FIELDS(Eina_Mempool *)
581 } mp_rtl; /* For Right To Left interface */
582
580 Edje_Part_Collection *ref; 583 Edje_Part_Collection *ref;
581}; 584};
582 585
@@ -635,6 +638,7 @@ struct _Edje_Part_Collection
635 638
636 struct { 639 struct {
637 Edje_Size min, max; 640 Edje_Size min, max;
641 unsigned char orientation;
638 } prop; 642 } prop;
639 643
640 int references; 644 int references;
@@ -683,6 +687,7 @@ typedef struct _Edje_Part_Description_List Edje_Part_Description_List;
683struct _Edje_Part_Description_List 687struct _Edje_Part_Description_List
684{ 688{
685 Edje_Part_Description_Common **desc; 689 Edje_Part_Description_Common **desc;
690 Edje_Part_Description_Common **desc_rtl; /* desc for Right To Left interface */
686 unsigned int desc_count; 691 unsigned int desc_count;
687}; 692};
688 693
@@ -690,6 +695,7 @@ struct _Edje_Part
690{ 695{
691 const char *name; /* the name if any of the part */ 696 const char *name; /* the name if any of the part */
692 Edje_Part_Description_Common *default_desc; /* the part descriptor for default */ 697 Edje_Part_Description_Common *default_desc; /* the part descriptor for default */
698 Edje_Part_Description_Common *default_desc_rtl; /* default desc for Right To Left interface */
693 699
694 Edje_Part_Description_List other; /* other possible descriptors */ 700 Edje_Part_Description_List other; /* other possible descriptors */
695 701
@@ -986,6 +992,7 @@ struct _Edje
986 int load_error; 992 int load_error;
987 int freeze; 993 int freeze;
988 FLOAT_T scale; 994 FLOAT_T scale;
995 Eina_Bool is_rtl : 1;
989 996
990 struct { 997 struct {
991 Edje_Text_Change_Cb func; 998 Edje_Text_Change_Cb func;
@@ -1077,6 +1084,7 @@ struct _Edje_Real_Part_Set
1077struct _Edje_Real_Part_State 1084struct _Edje_Real_Part_State
1078{ 1085{
1079 Edje_Part_Description_Common *description; // 4 1086 Edje_Part_Description_Common *description; // 4
1087 Edje_Part_Description_Common *description_rtl; // 4
1080 Edje_Real_Part *rel1_to_x; // 4 1088 Edje_Real_Part *rel1_to_x; // 4
1081 Edje_Real_Part *rel1_to_y; // 4 1089 Edje_Real_Part *rel1_to_y; // 4
1082 Edje_Real_Part *rel2_to_x; // 4 1090 Edje_Real_Part *rel2_to_x; // 4
@@ -1087,8 +1095,8 @@ struct _Edje_Real_Part_State
1087#endif 1095#endif
1088 void *external_params; // 4 1096 void *external_params; // 4
1089 Edje_Real_Part_Set *set; // 4 1097 Edje_Real_Part_Set *set; // 4
1090}; // 28 1098}; // 32
1091// WITH EDJE_CALC_CACHE 128 1099// WITH EDJE_CALC_CACHE 132
1092 1100
1093struct _Edje_Real_Part_Drag 1101struct _Edje_Real_Part_Drag
1094{ 1102{
@@ -1832,4 +1840,6 @@ void _edje_lua2_script_func_signal(Edje *ed, const char *sig, const char *src);
1832const char *edje_string_get(const Edje_String *es); 1840const char *edje_string_get(const Edje_String *es);
1833const char *edje_string_id_get(const Edje_String *es); 1841const char *edje_string_id_get(const Edje_String *es);
1834 1842
1843void _edje_object_orientation_inform(Evas_Object *obj);
1844
1835#endif 1845#endif
diff --git a/legacy/edje/src/lib/edje_smart.c b/legacy/edje/src/lib/edje_smart.c
index 4964a757b2..358e6b6351 100644
--- a/legacy/edje/src/lib/edje_smart.c
+++ b/legacy/edje/src/lib/edje_smart.c
@@ -30,12 +30,18 @@ Eina_List *_edje_edjes = NULL;
30EAPI Evas_Object * 30EAPI Evas_Object *
31edje_object_add(Evas *evas) 31edje_object_add(Evas *evas)
32{ 32{
33 Edje *ed;
34 Evas_Object *e;
33 if (!_edje_smart) 35 if (!_edje_smart)
34 { 36 {
35 _edje_object_smart_set(&_edje_smart_class); 37 _edje_object_smart_set(&_edje_smart_class);
36 _edje_smart = evas_smart_class_new((Evas_Smart_Class *)&_edje_smart_class); 38 _edje_smart = evas_smart_class_new((Evas_Smart_Class *)&_edje_smart_class);
37 } 39 }
38 return evas_object_smart_add(evas, _edje_smart); 40
41 e = evas_object_smart_add(evas, _edje_smart);
42 ed = _edje_fetch(e);
43
44 return e;
39} 45}
40 46
41void 47void
@@ -103,6 +109,7 @@ _edje_smart_add(Evas_Object *obj)
103 evas_object_move(ed->clipper, -10000, -10000); 109 evas_object_move(ed->clipper, -10000, -10000);
104 evas_object_resize(ed->clipper, 20000, 20000); 110 evas_object_resize(ed->clipper, 20000, 20000);
105 evas_object_pass_events_set(ed->clipper, 1); 111 evas_object_pass_events_set(ed->clipper, 1);
112 ed->is_rtl = EINA_FALSE;
106 ed->have_objects = 1; 113 ed->have_objects = 1;
107 ed->references = 1; 114 ed->references = 1;
108 115
diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c
index 8f8d9e0535..c7aea06435 100644
--- a/legacy/edje/src/lib/edje_util.c
+++ b/legacy/edje/src/lib/edje_util.c
@@ -262,6 +262,73 @@ edje_object_scale_get(const Evas_Object *obj)
262} 262}
263 263
264/** 264/**
265 * Get the RTL orientation for this object.
266 *
267 * You can RTL orientation explicitly with edje_object_mirrored_set.
268 *
269 * @param obj the smart object
270 * @return if flag is set or not.
271 *
272 **/
273EAPI Eina_Bool
274edje_object_mirrored_get(const Evas_Object *obj)
275{
276 Edje *ed;
277
278 ed = _edje_fetch(obj);
279 if (!ed) return EINA_FALSE;
280
281 return ed->is_rtl;
282}
283
284void
285_edje_object_orientation_inform(Evas_Object *obj)
286{
287 if (edje_object_mirrored_get(obj))
288 edje_object_signal_emit(obj, "edje,state,rtl", "edje");
289 else
290 edje_object_signal_emit(obj, "edje,state,ltr", "edje");
291}
292
293/**
294 * Set the RTL orientation for this object.
295 *
296 * @param obj the smart object
297 * @rtl new value of flag EINA_TRUE/EINA_FALSE
298 *
299 **/
300EAPI void
301edje_object_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
302{
303 Edje *ed;
304 int i;
305
306 ed = _edje_fetch(obj);
307 if (!ed) return;
308 if (ed->is_rtl == rtl) return;
309
310 ed->is_rtl = rtl;
311
312 for (i = 0 ; i < ed->table_parts_size ; i++)
313 {
314 Edje_Real_Part *ep;
315 const char *s;
316 double v;
317
318 ep = ed->table_parts[i];
319 s = ep->param1.description->state.name,
320 v = ep->param1.description->state.value;
321 _edje_part_description_apply(ed, ep, s, v , NULL, 0.0);
322 ep->chosen_description = ep->param1.description;
323 }
324 _edje_recalc_do(ed);
325
326 _edje_object_orientation_inform(obj);
327
328 return;
329}
330
331/**
265 * @brief Get Edje object data. 332 * @brief Get Edje object data.
266 * 333 *
267 * @param obj A valid Evas_Object handle 334 * @param obj A valid Evas_Object handle