edje_edit: fix wrong generation of part's source code (effect field).
authorVorobiov Vitalii <vi.vorobiov@samsung.com>
Tue, 1 Apr 2014 10:11:27 +0000 (19:11 +0900)
committerCedric BAIL <cedric.bail@free.fr>
Tue, 1 Apr 2014 13:00:13 +0000 (22:00 +0900)
There is a static array that is used for parsing the current effect
(in Part's struction the effect type is represented by a number) from a number
to text. But there is one type of effects (SHADOW) that has a number combined from
two types. First four bits are always used for defining the effect's type,
but if it is a SHADOW effect, then there is four more bits. They are representing
the direction of the shadow in TEXT block.
This patch fixes code regeneration after saving edje_edit object, so now
it splits the number into two pieces, so we can fully regenerate type of effect.

So, in this path:
- added static array that represents shadow's direction.
- part's source code generaton has been modified.

Reviewers: seoz, raster, cedric

Reviewed By: cedric

CC: reutskiy.v.v, cedric
Differential Revision: https://phab.enlightenment.org/D668

Signed-off-by: Cedric BAIL <cedric.bail@free.fr>
src/lib/edje/edje_edit.c

index 3d260e1..db301f1 100644 (file)
@@ -7058,7 +7058,8 @@ edje_edit_script_error_list_get(Evas_Object *obj)
      }
 
 static const char *types[] = {"NONE", "RECT", "TEXT", "IMAGE", "SWALLOW", "TEXTBLOCK", "GRADIENT", "GROUP", "BOX", "TABLE", "EXTERNAL", "PROXY", "SPACER"};
-static const char *effects[] = {"NONE", "PLAIN", "OUTLINE", "SOFT_OUTLINE", "SHADOW", "SOFT_SHADOW", "OUTLINE_SHADOW", "OUTLINE_SOFT_SHADOW ", "FAR_SHADOW ", "FAR_SOFT_SHADOW", "GLOW"};
+static const char *effects[] = {"NONE", "PLAIN", "OUTLINE", "SOFT_OUTLINE", "SHADOW", "SOFT_SHADOW", "OUTLINE_SHADOW", "OUTLINE_SOFT_SHADOW", "FAR_SHADOW", "FAR_SOFT_SHADOW", "GLOW"};
+static const char *shadow_direction[] = {"BOTTOM_RIGHT", "BOTTOM", "BOTTOM_LEFT", "LEFT", "TOP_LEFT", "TOP", "TOP_RIGHT", "RIGHT"};
 static const char *prefers[] = {"NONE", "VERTICAL", "HORIZONTAL", "BOTH"};
 
 static Eina_Bool
@@ -7807,8 +7808,18 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf)
         edje_edit_string_free(str);
      }
    if (edje_edit_part_effect_get(obj, part))
-     BUF_APPENDF(I4"effect: %s;\n",
-                effects[edje_edit_part_effect_get(obj, part)]);
+     {
+        int effect = edje_edit_part_effect_get(obj, part);
+        if (effect & EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION)
+          {
+             BUF_APPENDF(I4"effect: %s %s;\n",
+                         effects[effect & ~EDJE_TEXT_EFFECT_MASK_SHADOW_DIRECTION],
+                         shadow_direction[effect >> 4]);
+          }
+        else
+          BUF_APPENDF(I4"effect: %s;\n",
+                      effects[effect]);
+     }
 
    //Dragable
    if (edje_edit_part_drag_x_get(obj, part) ||
@@ -8526,4 +8537,4 @@ edje_edit_print_internal_status(Evas_Object *obj)
  */
 }
 
-#include "edje_edit.eo.c"
\ No newline at end of file
+#include "edje_edit.eo.c"