config: add "language_auto_mirrored"
authorJaeun Choi <jaeun12.choi@samsung.com>
Fri, 18 Nov 2016 07:07:32 +0000 (16:07 +0900)
committerJinYong Park <j4939.park@samsung.com>
Tue, 22 Nov 2016 10:46:57 +0000 (19:46 +0900)
when language_auto_mirrored is true, elm_config_mirrored_set() will be
called automatically according to "default:LTR" value in elm_language_set() function.
for initialization, it needs to be done in translation_init() as well,
but according to appcore issue, we do it in elm_win_add() time temporarily.
when it is false, mirroring will be done manually by calling
elm_config_mirrored_set().
this patch will take effect with efl-misc package.

Change-Id: I2584ced52dd7586785d355af53e49a49eff94ffc

src/lib/elm_config.c
src/lib/elm_config.h
src/lib/elm_priv.h
src/lib/elm_win.c

index 8464119a64ed790fefbbe4426d65772eac96f9ea..6218d0c86623614d192d5d0e038bacfd90f40b6f 100644 (file)
@@ -464,6 +464,7 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, scroll_item_align_enable, T_UCHAR);
    ELM_CONFIG_VAL(D, T, scroll_item_valign, T_STRING);
    //
+   ELM_CONFIG_VAL(D, T, language_auto_mirrored, T_UCHAR);
 #undef T
 #undef D
 #undef T_INT
@@ -1825,6 +1826,7 @@ _config_load(void)
    _elm_config->scroll_item_align_enable = EINA_FALSE;
    _elm_config->scroll_item_valign = eina_stringshare_add("center");
    //
+   _elm_config->language_auto_mirrored = EINA_TRUE;
 }
 
 static void
@@ -2595,6 +2597,21 @@ elm_config_mirrored_set(Eina_Bool mirrored)
    _elm_rescale();
 }
 
+EAPI Eina_Bool
+elm_config_language_auto_mirrored_get(void)
+{
+   return _elm_config->language_auto_mirrored;
+}
+
+EAPI void
+elm_config_language_auto_mirrored_set(Eina_Bool automatic)
+{
+   automatic = !!automatic;
+   if (_elm_config->language_auto_mirrored == automatic) return;
+   _elm_config->language_auto_mirrored = automatic;
+   _elm_rescale();
+}
+
 EAPI Eina_Bool
 elm_config_cursor_engine_only_get(void)
 {
index fab0731a07228906464d43f2c0d4839e98585cee..7e48447cda030247b3c3df2bf737cf3fbc143aad 100644 (file)
@@ -2226,6 +2226,22 @@ EAPI Eina_Bool elm_config_mirrored_get(void);
  */
 EAPI void      elm_config_mirrored_set(Eina_Bool mirrored);
 
+/**
+ * Get the system auto mirrored mode.
+ * This determines whether the mirrored mode is determined automatically by the locale or not.
+ *
+ * @return @c EINA_TRUE if mirrored is set, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool elm_config_language_auto_mirrored_get(void);
+
+/**
+ * Set the system auto mirrored mode.
+ * This determines whether the mirrored mode is determined automatically by the locale or not.
+ *
+ * @param mirrored @c EINA_TRUE to set auto mirrored mode, @c EINA_FALSE to unset it.
+ */
+EAPI void      elm_config_language_auto_mirrored_set(Eina_Bool auto_mirrored);
+
 /**
  * @internal
  *
index d3880cfd67b615421155f3409785702b7b280709..549b01d5ef7336cf43c6d6b81f7380316b335aa3 100644 (file)
@@ -320,6 +320,7 @@ struct _Elm_Config
    Eina_Bool     scroll_item_align_enable;
    const char   *scroll_item_valign;
 //
+   Eina_Bool     language_auto_mirrored;
 
    /* Not part of the EET file */
    Eina_Bool     is_mirrored : 1;
index 8ba87841712b576f2b633b82b93fb40981495986..7accd2a137665b607ec7b82da6bb9246b6c9f688 100644 (file)
@@ -3003,6 +3003,17 @@ _elm_win_translate(void)
         elm_widget_translate(obj);
      }
    /* END */
+
+   /* TIZEN_ONLY(20161117): Temporary code
+      Apply mirroring according to config in elm_win_add() time */
+   if (_elm_config->language_auto_mirrored)
+     {
+        if (!strcmp(E_("default:LTR"), "default:RTL"))
+          elm_config_mirrored_set(EINA_TRUE);
+        else
+          elm_config_mirrored_set(EINA_FALSE);
+     }
+   /* END */
 }
 
 void
@@ -4683,6 +4694,14 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_
      evas_object_paragraph_direction_set(obj, EVAS_BIDI_DIRECTION_LTR);
    /* END */
 
+   if (_elm_config->language_auto_mirrored)
+     {
+        if (!strcmp(E_("default:LTR"), "default:RTL"))
+          elm_config_mirrored_set(EINA_TRUE);
+        else
+          elm_config_mirrored_set(EINA_FALSE);
+     }
+
    return obj;
 }