summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrii Kroitor <an.kroitor@samsung.com>2013-10-30 21:54:23 +0900
committerCedric Bail <cedric.bail@free.fr>2013-10-30 22:30:15 +0900
commit5d0e0c3f16c12fa7e26343bae019c6d622871540 (patch)
tree3248c03ae0d2218278a9467e10d746b8184c7b8f /src
parent503cbbe80b432bb368bd16f2af4c63c873d1a610 (diff)
edje: make edje edit rel setters return Eina_Bool.
Make the following function return an Eina_Bool so the caller can detect errors if it want : edje_edit_state_rel1_relative_x_set edje_edit_state_rel1_relative_y_set edje_edit_state_rel2_relative_x_set edje_edit_state_rel2_relative_y_set edje_edit_state_rel1_offset_x_set edje_edit_state_rel1_offset_y_set edje_edit_state_rel2_offset_x_set edje_edit_state_rel2_offset_y_set edje_edit_state_rel1_to_x_set edje_edit_state_rel1_to_y_set edje_edit_state_rel2_to_x_set edje_edit_state_rel2_to_y_set Reviewers: cedric, seoz CC: reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D296 Signed-off-by: Cedric Bail <cedric.bail@free.fr>
Diffstat (limited to 'src')
-rw-r--r--src/lib/edje/Edje_Edit.h48
-rw-r--r--src/lib/edje/edje_edit.c101
2 files changed, 82 insertions, 67 deletions
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index 18c31b8ae6..31ec1a94ad 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -1260,8 +1260,10 @@ EAPI double edje_edit_state_rel2_relative_y_get(Evas_Object *obj, const char *pa
1260 * @param state The name of the state to set 'rel1 relative X' (not including the state value). 1260 * @param state The name of the state to set 'rel1 relative X' (not including the state value).
1261 * @param value The state value. 1261 * @param value The state value.
1262 * @param x The new 'rel1 relative X' value to set'. 1262 * @param x The new 'rel1 relative X' value to set'.
1263 *
1264 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1263 */ 1265 */
1264EAPI void edje_edit_state_rel1_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); 1266EAPI Eina_Bool edje_edit_state_rel1_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1265 1267
1266/** Set the 'rel1 relative Y' value of state. 1268/** Set the 'rel1 relative Y' value of state.
1267 * 1269 *
@@ -1270,8 +1272,10 @@ EAPI void edje_edit_state_rel1_relative_x_set(Evas_Object *obj, const char *part
1270 * @param state The name of the state to set 'rel1 relative Y' (not including the state value). 1272 * @param state The name of the state to set 'rel1 relative Y' (not including the state value).
1271 * @param value The state value. 1273 * @param value The state value.
1272 * @param y The new 'rel1 relative Y' value to set'. 1274 * @param y The new 'rel1 relative Y' value to set'.
1275 *
1276 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1273 */ 1277 */
1274EAPI void edje_edit_state_rel1_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y); 1278EAPI Eina_Bool edje_edit_state_rel1_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y);
1275 1279
1276/** Set the 'rel2 relative X' value of state. 1280/** Set the 'rel2 relative X' value of state.
1277 * 1281 *
@@ -1280,8 +1284,10 @@ EAPI void edje_edit_state_rel1_relative_y_set(Evas_Object *obj, const char *part
1280 * @param state The name of the state to set 'rel2 relative X' (not including the state value). 1284 * @param state The name of the state to set 'rel2 relative X' (not including the state value).
1281 * @param value The state value. 1285 * @param value The state value.
1282 * @param x The new 'rel2 relative X' value to set'. 1286 * @param x The new 'rel2 relative X' value to set'.
1287 *
1288 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1283 */ 1289 */
1284EAPI void edje_edit_state_rel2_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); 1290EAPI Eina_Bool edje_edit_state_rel2_relative_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1285 1291
1286/** Set the 'rel2 relative Y' value of state. 1292/** Set the 'rel2 relative Y' value of state.
1287 * 1293 *
@@ -1290,8 +1296,10 @@ EAPI void edje_edit_state_rel2_relative_x_set(Evas_Object *obj, const char *part
1290 * @param state The name of the state to set 'rel2 relative Y' (not including the state value). 1296 * @param state The name of the state to set 'rel2 relative Y' (not including the state value).
1291 * @param value The state value. 1297 * @param value The state value.
1292 * @param y The new 'rel2 relative Y' value to set'. 1298 * @param y The new 'rel2 relative Y' value to set'.
1299 *
1300 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1293 */ 1301 */
1294EAPI void edje_edit_state_rel2_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y); 1302EAPI Eina_Bool edje_edit_state_rel2_relative_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y);
1295 1303
1296/** Get the 'rel1 offset X' value of state. 1304/** Get the 'rel1 offset X' value of state.
1297 * 1305 *
@@ -1344,8 +1352,10 @@ EAPI int edje_edit_state_rel2_offset_y_get(Evas_Object *obj, const char *part, c
1344 * @param state The name of the state to set 'rel1 offset X' (not including the state value). 1352 * @param state The name of the state to set 'rel1 offset X' (not including the state value).
1345 * @param value The state value. 1353 * @param value The state value.
1346 * @param x The new 'rel1 offset X' value to set'. 1354 * @param x The new 'rel1 offset X' value to set'.
1355 *
1356 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1347 */ 1357 */
1348EAPI void edje_edit_state_rel1_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); 1358EAPI Eina_Bool edje_edit_state_rel1_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1349 1359
1350/** Set the 'rel1 offset Y' value of state. 1360/** Set the 'rel1 offset Y' value of state.
1351 * 1361 *
@@ -1354,8 +1364,10 @@ EAPI void edje_edit_state_rel1_offset_x_set(Evas_Object *obj, const char *part,
1354 * @param state The name of the state to set 'rel1 offset Y' (not including the state value). 1364 * @param state The name of the state to set 'rel1 offset Y' (not including the state value).
1355 * @param value The state value. 1365 * @param value The state value.
1356 * @param y The new 'rel1 offset Y' value to set'. 1366 * @param y The new 'rel1 offset Y' value to set'.
1367 *
1368 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1357 */ 1369 */
1358EAPI void edje_edit_state_rel1_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y); 1370EAPI Eina_Bool edje_edit_state_rel1_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y);
1359 1371
1360/** Set the 'rel2 offset X' value of state. 1372/** Set the 'rel2 offset X' value of state.
1361 * 1373 *
@@ -1364,8 +1376,10 @@ EAPI void edje_edit_state_rel1_offset_y_set(Evas_Object *obj, const char *part,
1364 * @param state The name of the state to set 'rel2 offset X' (not including the state value). 1376 * @param state The name of the state to set 'rel2 offset X' (not including the state value).
1365 * @param value The state value. 1377 * @param value The state value.
1366 * @param x The new 'rel2 offset X' value to set'. 1378 * @param x The new 'rel2 offset X' value to set'.
1379 *
1380 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1367 */ 1381 */
1368EAPI void edje_edit_state_rel2_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x); 1382EAPI Eina_Bool edje_edit_state_rel2_offset_x_set(Evas_Object *obj, const char *part, const char *state, double value, double x);
1369 1383
1370/** Set the 'rel2 offset Y' value of state. 1384/** Set the 'rel2 offset Y' value of state.
1371 * 1385 *
@@ -1374,8 +1388,10 @@ EAPI void edje_edit_state_rel2_offset_x_set(Evas_Object *obj, const char *part,
1374 * @param state The name of the state to set 'rel2 offset Y' (not including the state value). 1388 * @param state The name of the state to set 'rel2 offset Y' (not including the state value).
1375 * @param value The state value. 1389 * @param value The state value.
1376 * @param y The new 'rel2 offset Y' value to set'. 1390 * @param y The new 'rel2 offset Y' value to set'.
1391 *
1392 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1377 */ 1393 */
1378EAPI void edje_edit_state_rel2_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y); 1394EAPI Eina_Bool edje_edit_state_rel2_offset_y_set(Evas_Object *obj, const char *part, const char *state, double value, double y);
1379 1395
1380/** Get the part name rel1x is relative to. 1396/** Get the part name rel1x is relative to.
1381 * 1397 *
@@ -1429,9 +1445,9 @@ EAPI const char * edje_edit_state_rel2_to_y_get(Evas_Object *obj, const char *pa
1429 * @param value The state value. 1445 * @param value The state value.
1430 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface). 1446 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface).
1431 * 1447 *
1432 * @return The part name rel1x is relative to or NULL if the part is relative to the whole interface. 1448 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1433 */ 1449 */
1434EAPI void edje_edit_state_rel1_to_x_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to); 1450EAPI Eina_Bool edje_edit_state_rel1_to_x_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to);
1435 1451
1436/** Set the part rel1y is relative to. 1452/** Set the part rel1y is relative to.
1437 * 1453 *
@@ -1441,9 +1457,9 @@ EAPI void edje_edit_state_rel1_to_x_set(Evas_Object *obj, const char *part, cons
1441 * @param value The state value. 1457 * @param value The state value.
1442 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface). 1458 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface).
1443 * 1459 *
1444 * @return The part name rel1y is relative to or NULL if the part is relative to the whole interface. 1460 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1445 */ 1461 */
1446EAPI void edje_edit_state_rel1_to_y_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to); 1462EAPI Eina_Bool edje_edit_state_rel1_to_y_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to);
1447 1463
1448/** Set the part rel2x is relative to. 1464/** Set the part rel2x is relative to.
1449 * 1465 *
@@ -1453,9 +1469,9 @@ EAPI void edje_edit_state_rel1_to_y_set(Evas_Object *obj, const char *part, cons
1453 * @param value The state value. 1469 * @param value The state value.
1454 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface). 1470 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface).
1455 * 1471 *
1456 * @return The part name rel2x is relative to or NULL if the part is relative to the whole interface. 1472 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1457 */ 1473 */
1458EAPI void edje_edit_state_rel2_to_x_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to); 1474EAPI Eina_Bool edje_edit_state_rel2_to_x_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to);
1459 1475
1460/** Set the part rel2y is relative to. 1476/** Set the part rel2y is relative to.
1461 * 1477 *
@@ -1465,9 +1481,9 @@ EAPI void edje_edit_state_rel2_to_x_set(Evas_Object *obj, const char *part, cons
1465 * @param value The state value. 1481 * @param value The state value.
1466 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface). 1482 * @param rel_to The name of the part that is used as container/parent (NULL make the part relative to the whole interface).
1467 * 1483 *
1468 * @return The part name rel2y is relative to or NULL if the part is relative to the whole interface. 1484 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1469 */ 1485 */
1470EAPI void edje_edit_state_rel2_to_y_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to); 1486EAPI Eina_Bool edje_edit_state_rel2_to_y_set(Evas_Object *obj, const char *part, const char *state, double value, const char *rel_to);
1471 1487
1472/** Get the color of a part state. 1488/** Get the color of a part state.
1473 * 1489 *
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index a4fa0dc7d6..384f97e76f 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -3176,19 +3176,20 @@ edje_edit_state_copy(Evas_Object *obj, const char *part, const char *from, doubl
3176 return EINA_TRUE; 3176 return EINA_TRUE;
3177} 3177}
3178 3178
3179#define FUNC_STATE_RELATIVE_DOUBLE(Sub, Value) \ 3179#define FUNC_STATE_RELATIVE_DOUBLE(Sub, Value) \
3180 EAPI double \ 3180 EAPI double \
3181 edje_edit_state_##Sub##_relative_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ 3181 edje_edit_state_##Sub##_relative_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
3182 { \ 3182 { \
3183 GET_PD_OR_RETURN(0); \ 3183 GET_PD_OR_RETURN(0); \
3184 return TO_DOUBLE(pd->Sub.relative_##Value); \ 3184 return TO_DOUBLE(pd->Sub.relative_##Value); \
3185 } \ 3185 } \
3186 EAPI void \ 3186 EAPI Eina_Bool \
3187 edje_edit_state_##Sub##_relative_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \ 3187 edje_edit_state_##Sub##_relative_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
3188 { \ 3188 { \
3189 GET_PD_OR_RETURN(); \ 3189 GET_PD_OR_RETURN(EINA_FALSE); \
3190 pd->Sub.relative_##Value = FROM_DOUBLE(v); \ 3190 pd->Sub.relative_##Value = FROM_DOUBLE(v); \
3191 edje_object_calc_force(obj); \ 3191 edje_object_calc_force(obj); \
3192 return EINA_TRUE; \
3192 } 3193 }
3193 3194
3194FUNC_STATE_RELATIVE_DOUBLE(rel1, x); 3195FUNC_STATE_RELATIVE_DOUBLE(rel1, x);
@@ -3197,18 +3198,19 @@ FUNC_STATE_RELATIVE_DOUBLE(rel2, x);
3197FUNC_STATE_RELATIVE_DOUBLE(rel2, y); 3198FUNC_STATE_RELATIVE_DOUBLE(rel2, y);
3198 3199
3199#define FUNC_STATE_OFFSET_INT(Sub, Value) \ 3200#define FUNC_STATE_OFFSET_INT(Sub, Value) \
3200 EAPI int \ 3201 EAPI int \
3201 edje_edit_state_##Sub##_offset_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ 3202 edje_edit_state_##Sub##_offset_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
3202 { \ 3203 { \
3203 GET_PD_OR_RETURN(0); \ 3204 GET_PD_OR_RETURN(0); \
3204 return pd->Sub.offset_##Value; \ 3205 return pd->Sub.offset_##Value; \
3205 } \ 3206 } \
3206 EAPI void \ 3207 EAPI Eina_Bool \
3207 edje_edit_state_##Sub##_offset_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \ 3208 edje_edit_state_##Sub##_offset_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, double v) \
3208 { \ 3209 { \
3209 GET_PD_OR_RETURN(); \ 3210 GET_PD_OR_RETURN(EINA_FALSE); \
3210 pd->Sub.offset_##Value = TO_INT(FROM_DOUBLE(v)); \ 3211 pd->Sub.offset_##Value = TO_INT(FROM_DOUBLE(v)); \
3211 edje_object_calc_force(obj); \ 3212 edje_object_calc_force(obj); \
3213 return EINA_TRUE; \
3212 } 3214 }
3213 3215
3214FUNC_STATE_OFFSET_INT(rel1, x); 3216FUNC_STATE_OFFSET_INT(rel1, x);
@@ -3216,37 +3218,34 @@ FUNC_STATE_OFFSET_INT(rel1, y);
3216FUNC_STATE_OFFSET_INT(rel2, x); 3218FUNC_STATE_OFFSET_INT(rel2, x);
3217FUNC_STATE_OFFSET_INT(rel2, y); 3219FUNC_STATE_OFFSET_INT(rel2, y);
3218 3220
3219#define FUNC_STATE_REL(Sub, Value) \ 3221#define FUNC_STATE_REL(Sub, Value) \
3220 EAPI const char * \ 3222 EAPI const char * \
3221 edje_edit_state_##Sub##_to_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \ 3223 edje_edit_state_##Sub##_to_##Value##_get(Evas_Object *obj, const char *part, const char *state, double value) \
3222 { \ 3224 { \
3223 Edje_Real_Part *rel; \ 3225 Edje_Real_Part *rel; \
3224 \ 3226 GET_PD_OR_RETURN(NULL); \
3225 GET_PD_OR_RETURN(NULL); \ 3227 if (pd->Sub.id_##Value == -1) return NULL; \
3226 \
3227 if (pd->Sub.id_##Value == -1) return NULL; \
3228 \
3229 rel = ed->table_parts[pd->Sub.id_##Value % ed->table_parts_size]; \ 3228 rel = ed->table_parts[pd->Sub.id_##Value % ed->table_parts_size]; \
3230 \ 3229 if (rel->part->name) return eina_stringshare_add(rel->part->name); \
3231 if (rel->part->name) return eina_stringshare_add(rel->part->name); \ 3230 return NULL; \
3232 return NULL; \ 3231 } \
3233 } \ 3232 EAPI Eina_Bool \
3234 EAPI void \ 3233 edje_edit_state_##Sub##_to_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, const char *to) \
3235 edje_edit_state_##Sub##_to_##Value##_set(Evas_Object *obj, const char *part, const char *state, double value, const char *to) \ 3234 { \
3236 { \ 3235 Edje_Real_Part *relp; \
3237 Edje_Real_Part *relp; \ 3236 GET_PD_OR_RETURN(EINA_FALSE); \
3238 \ 3237 if ((to) && (strcmp(to, ""))) \
3239 GET_PD_OR_RETURN(); \ 3238 { \
3240 \ 3239 relp = _edje_real_part_get(ed, to); \
3241 if (to) \ 3240 if (!relp) return EINA_FALSE; \
3242 { \ 3241 pd->Sub.id_##Value = relp->part->id; \
3243 relp = _edje_real_part_get(ed, to); \ 3242 return EINA_TRUE; \
3244 if (!relp) return; \ 3243 } \
3245 pd->Sub.id_##Value = relp->part->id; \ 3244 else \
3246 } \ 3245 { \
3247 else \ 3246 pd->Sub.id_##Value = -1; \
3248 pd->Sub.id_##Value = -1; \ 3247 return EINA_FALSE; \
3249 \ 3248 } \
3250 } 3249 }
3251//note after this call edje_edit_part_selected_state_set() to update !! need to fix this 3250//note after this call edje_edit_part_selected_state_set() to update !! need to fix this
3252//_edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, "state", 0.1); //Why segfault?? 3251//_edje_part_description_apply(ed, rp, pd->state.name, pd->state.value, "state", 0.1); //Why segfault??