Evas: Added align=auto format to textblock.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 11 Aug 2010 07:46:37 +0000 (07:46 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 11 Aug 2010 07:46:37 +0000 (07:46 +0000)
This is the default. This lets you make textblock (or parts affected by this tag) auto align according to the natural paragraph direction.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@50985 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_textblock.c

index cd1cf17..718bf41 100644 (file)
@@ -1246,26 +1246,33 @@ _format_command(Evas_Object *obj, Evas_Object_Textblock_Format *fmt, const char
            &(fmt->color.strikethrough.b), &(fmt->color.strikethrough.a));
    else if (cmd == alignstr)
      {
-        if (!strcmp(tmp_param, "middle")) fmt->halign = 0.5;
-        else if (!strcmp(tmp_param, "center")) fmt->halign = 0.5;
-        else if (!strcmp(tmp_param, "left")) fmt->halign = 0.0;
-        else if (!strcmp(tmp_param, "right")) fmt->halign = 1.0;
+        if (!strcmp(tmp_param, "auto"))
+          {
+             fmt->halign_auto = EINA_TRUE;
+          }
         else
           {
-             char *endptr = NULL;
-             double val = strtod(tmp_param, &endptr);
-             if (endptr)
+             if (!strcmp(tmp_param, "middle")) fmt->halign = 0.5;
+             else if (!strcmp(tmp_param, "center")) fmt->halign = 0.5;
+             else if (!strcmp(tmp_param, "left")) fmt->halign = 0.0;
+             else if (!strcmp(tmp_param, "right")) fmt->halign = 1.0;
+             else
                {
-                  while (*endptr && _is_white(*endptr))
-                    endptr++;
-                  if (*endptr == '%')
-                    val /= 100.0;
+                  char *endptr = NULL;
+                  double val = strtod(tmp_param, &endptr);
+                  if (endptr)
+                    {
+                       while (*endptr && _is_white(*endptr))
+                         endptr++;
+                       if (*endptr == '%')
+                         val /= 100.0;
+                    }
+                  fmt->halign = val;
+                  if (fmt->halign < 0.0) fmt->halign = 0.0;
+                  else if (fmt->halign > 1.0) fmt->halign = 1.0;
                }
-             fmt->halign = val;
-             if (fmt->halign < 0.0) fmt->halign = 0.0;
-             else if (fmt->halign > 1.0) fmt->halign = 1.0;
+             fmt->halign_auto = EINA_FALSE;
           }
-        fmt->halign_auto = EINA_FALSE;
      }
    else if (cmd == valignstr)
      {