Elementary: Added the infrastructure for ui-mirroring support.

* Added elm_mirrored_get/set to set the system mirrored mode
* Added elm_widget_mirrored/get/set to set each widget's mirrored mode.
* Added code to set the system mirrored mode from translations to elementary and added translations for all the rtl languages. (a trick to load according to locale).
* Future commits will include specific widgets mirrored mode handling.
Work by Aharon Hillel and Tom Hacohen.

SVN revision: 56673
This commit is contained in:
Tom Hacohen 2011-02-03 15:52:49 +00:00
parent a22d8668a5
commit 689ff9abd5
21 changed files with 337 additions and 4 deletions

View File

@ -34,3 +34,5 @@ Seunggyun Kim <sgyun.kim@samsung.com> <tmdrbs@gmail.com>
Sohyun Kim <anna1014.kim@samsung.com> <sohyun.anna@gmail.com>
Jihoon Kim <jihoon48.kim@samsung.com>
Jeonghyun Yun (arosis) <jh0506.yun@samsung.com>
Tom Hacohen <tom@stosb.com>
Aharon Hillel <a.hillel@partner.samsung.com>

View File

@ -1,8 +1,15 @@
SUBDIRS = src data config doc
if HAVE_PO
SUBDIRS += po
endif
ACLOCAL_AMFLAGS = -I m4
MAINTAINERCLEANFILES = \
ABOUT-NLS \
Makefile.in \
aclocal.m4 \
config.guess \
@ -20,7 +27,33 @@ m4/libtool.m4 \
m4/lt~obsolete.m4 \
m4/ltoptions.m4 \
m4/ltsugar.m4 \
m4/ltversion.m4
m4/ltversion.m4 \
m4/gettext.m4 \
m4/iconv.m4 \
m4/lcmessage.m4 \
m4/lib-ld.m4 \
m4/lib-link.m4 \
m4/lib-prefix.m4 \
m4/nls.m4 \
m4/po.m4 \
m4/progtest.m4
if HAVE_PO
MAINTAINERCLEANFILES += \
po/boldquot.sed \
po/en@boldquot.header \
po/en@quot.header \
po/insert-header.sin \
po/Makefile.in.in \
po/Makevars.template \
po/quot.sed \
po/remove-potcdate.sin \
po/Rules-quot
endif
EXTRA_DIST = \
@ -33,7 +66,8 @@ elementary.spec \
elementary.spec.in \
m4/ac_attribute.m4 \
m4/efl_binary.m4 \
m4/efl_doxygen.m4
m4/efl_doxygen.m4 \
config.rpath
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = elementary.pc

View File

@ -5,6 +5,7 @@ rm -f aclocal.m4 ltmain.sh
touch README
echo "Running autopoint..." ; autopoint -f || :
echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
echo "Running autoheader..." ; autoheader || exit 1
echo "Running autoconf..." ; autoconf || exit 1

View File

@ -108,6 +108,15 @@ else
fi
AC_SUBST(pkgconfig_requires_private)
#================================================
if test "x${prefix}" = "xNONE"; then
LOCALE_DIR="${ac_default_prefix}/share/locale"
else
LOCALE_DIR="${prefix}/share/locale"
fi
AC_SUBST(LOCALE_DIR)
#================================================
lt_enable_auto_import=""
ELM_UNIX_DEF="#undef"
ELM_WIN32_DEF="#undef"
@ -476,6 +485,20 @@ EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
EFL_ENABLE_BIN([elementary-test])
EFL_ENABLE_BIN([elementary-config])
m4_ifdef([AM_GNU_GETTEXT_VERSION], [
AM_GNU_GETTEXT_VERSION([0.12.1])
])
m4_ifdef([AM_GNU_GETTEXT], [
AM_GNU_GETTEXT([external])
po_makefile_in=po/Makefile.in
AM_CONDITIONAL([HAVE_PO], [true])
],[
AM_CONDITIONAL([HAVE_PO], [false])
])
AC_SUBST(LTLIBINTL)
AC_OUTPUT([
Makefile
elementary.spec
@ -500,6 +523,7 @@ config/Makefile
config/default/Makefile
config/standard/Makefile
config/illume/Makefile
$po_makefile_in
])
#####################################################################

View File

@ -0,0 +1,11 @@
2010-12-26 gettextize <bug-gnu-gettext@gnu.org>
* Makefile.in.in: New file, from gettext-0.17.
* Rules-quot: New file, from gettext-0.17.
* boldquot.sed: New file, from gettext-0.17.
* en@boldquot.header: New file, from gettext-0.17.
* en@quot.header: New file, from gettext-0.17.
* insert-header.sin: New file, from gettext-0.17.
* quot.sed: New file, from gettext-0.17.
* remove-potcdate.sin: New file, from gettext-0.17.

View File

@ -0,0 +1 @@
ar az_IR fa he ps ur yi

View File

@ -0,0 +1,41 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --from-code=UTF-8 --foreign-user
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Enlightenment development team
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS = enlightenment-devel@lists.sourceforge.net
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =

View File

@ -0,0 +1 @@
src/lib/elm_config.c

View File

@ -0,0 +1,21 @@
# Elementary translation file for Left To Right languages.
# This file is distributed under the same license as the Elementary package.
# FIRST AUTHOR <tom.hacohen@partner.samsung.com>, 2010.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: elementary\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-01-31 15:28+0200\n"
"PO-Revision-Date: 2010-12-26 10:05+0200\n"
"Last-Translator: Tom Hacohen <tom.hacohen@partner.samsung.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
#: src/lib/elm_config.c:1537
msgid "default:LTR"
msgstr "default:RTL"

View File

@ -0,0 +1,20 @@
# Elementary translation file for Left To Right languages.
# This file is distributed under the same license as the Elementary package.
# FIRST AUTHOR <tom.hacohen@partner.samsung.com>, 2010.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: elementary\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-01-31 15:28+0200\n"
"PO-Revision-Date: 2010-12-26 10:05+0200\n"
"Last-Translator: Tom Hacohen <tom.hacohen@partner.samsung.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: src/lib/elm_config.c:1537
msgid "default:LTR"
msgstr "default:RTL"

View File

@ -0,0 +1,20 @@
# Elementary translation file for Left To Right languages.
# This file is distributed under the same license as the Elementary package.
# FIRST AUTHOR <tom.hacohen@partner.samsung.com>, 2010.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: elementary\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-01-31 15:28+0200\n"
"PO-Revision-Date: 2010-12-26 10:05+0200\n"
"Last-Translator: Tom Hacohen <tom.hacohen@partner.samsung.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: src/lib/elm_config.c:1537
msgid "default:LTR"
msgstr "default:RTL"

View File

@ -0,0 +1,20 @@
# Elementary translation file for Left To Right languages.
# This file is distributed under the same license as the Elementary package.
# FIRST AUTHOR <a.hillel@partner.samsung.com>, 2010.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: elementary\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-01-31 15:28+0200\n"
"PO-Revision-Date: 2010-12-26 10:05+0200\n"
"Last-Translator: Aharon Hillel <a.hillel@partner.samsung.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: src/lib/elm_config.c:1537
msgid "default:LTR"
msgstr "default:RTL"

View File

@ -0,0 +1,19 @@
# Elementary translation file for Left To Right languages.
# This file is distributed under the same license as the Elementary package.
# FIRST AUTHOR <tom.hacohen@partner.samsung.com>, 2010.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: elementary\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-01-31 15:28+0200\n"
"PO-Revision-Date: 2010-12-26 10:05+0200\n"
"Last-Translator: Tom Hacohen <tom.hacohen@partner.samsung.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/lib/elm_config.c:1537
msgid "default:LTR"
msgstr "default:RTL"

View File

@ -0,0 +1,19 @@
# Elementary translation file for Left To Right languages.
# This file is distributed under the same license as the Elementary package.
# FIRST AUTHOR <tom.hacohen@partner.samsung.com>, 2010.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: elementary\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-01-31 15:28+0200\n"
"PO-Revision-Date: 2010-12-26 10:05+0200\n"
"Last-Translator: Tom Hacohen <tom.hacohen@partner.samsung.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/lib/elm_config.c:1537
msgid "default:LTR"
msgstr "default:RTL"

View File

@ -0,0 +1,19 @@
# Elementary translation file for Left To Right languages.
# This file is distributed under the same license as the Elementary package.
# FIRST AUTHOR <tom.hacohen@partner.samsung.com>, 2010.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: elementary\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2011-01-31 15:28+0200\n"
"PO-Revision-Date: 2010-12-26 10:05+0200\n"
"Last-Translator: Tom Hacohen <tom.hacohen@partner.samsung.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/lib/elm_config.c:1537
msgid "default:LTR"
msgstr "default:RTL"

View File

@ -276,6 +276,8 @@ extern "C" {
EAPI const char *elm_object_style_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_object_disabled_set(Evas_Object *obj, Eina_Bool disabled) EINA_ARG_NONNULL(1);
EAPI Eina_Bool elm_object_disabled_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI Eina_Bool elm_widget_mirrored_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored) EINA_ARG_NONNULL(1);
EAPI Eina_Bool elm_object_widget_check(const Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI Evas_Object *elm_object_parent_widget_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
@ -286,6 +288,9 @@ extern "C" {
EAPI void elm_scale_set(double scale);
EAPI void elm_scale_all_set(double scale);
EAPI Eina_Bool elm_mirrored_get(void);
EAPI void elm_mirrored_set(Eina_Bool mirrored);
EAPI Eina_Bool elm_config_save(void);
EAPI void elm_config_reload(void);

View File

@ -9,6 +9,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib \
-I$(top_builddir)/src/lib \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
-DLOCALE_DIR=\"@LOCALE_DIR@\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
@ELEMENTARY_CFLAGS@ \
@ELEMENTARY_X_CFLAGS@ \

View File

@ -9,6 +9,8 @@
#include <Elementary.h>
#include "elm_priv.h"
#define _(string) gettext(string)
Elm_Config *_elm_config = NULL;
char *_elm_profile = NULL;
static Eet_Data_Descriptor *_config_edd = NULL;
@ -1131,6 +1133,7 @@ _config_load(void)
_elm_config->fps = 60.0;
_elm_config->theme = eina_stringshare_add("default");
_elm_config->modules = NULL;
_elm_config->is_mirrored = EINA_FALSE; /* Read sys value in env_get() */
_elm_config->tooltip_delay = 1.0;
_elm_config->cursor_engine_only = EINA_TRUE;
_elm_config->focus_highlight_enable = EINA_FALSE;
@ -1529,6 +1532,12 @@ _env_get(void)
s = getenv("ELM_MODULES");
if (s) eina_stringshare_replace(&_elm_config->modules, s);
/* Get RTL orientation from system */
setlocale(LC_ALL, "");
bindtextdomain("elementary", LOCALE_DIR);
textdomain("elementary");
_elm_config->is_mirrored = !strcmp(_("default:LTR"), "default:RTL");
s = getenv("ELM_TOOLTIP_DELAY");
if (s)
{
@ -1567,6 +1576,31 @@ _env_get(void)
if (s) _elm_config->effect_enable = !!atoi(s);
}
/**
* Get the system mirrored mode. This determines the default mirrored mode
* of widgets.
*
* @return EINA_TRUE if mirrored is set, EINA_FALSE otherwise
*/
EAPI Eina_Bool
elm_mirrored_get(void)
{
return _elm_config->is_mirrored;
}
/**
* Set the system mirrored mode. This determines the default mirrored mode
* of widgets.
*
* @param mirrored EINA_TRUE to set mirrored mode, EINA_FALSE to unset it.
*/
EAPI void
elm_mirrored_set(Eina_Bool mirrored)
{
/* TODO: Should update all interface */
_elm_config->is_mirrored = mirrored;
}
void
_elm_config_init(void)
{

View File

@ -111,6 +111,7 @@ struct _Elm_Config
Eina_Bool inwin_dialogs_enable;
int icon_size;
double longpress_timeout;
Eina_Bool is_mirrored : 1;
Eina_Bool effect_enable;
};

View File

@ -76,6 +76,7 @@ struct _Smart_Data
Eina_Bool highlight_ignore : 1;
Eina_Bool highlight_in_theme : 1;
Eina_Bool disabled : 1;
Eina_Bool is_mirrored : 1;
Eina_List *focus_chain;
Eina_List *event_cb;
@ -374,8 +375,11 @@ elm_widget_api_check(int ver)
EAPI Evas_Object *
elm_widget_add(Evas *evas)
{
Evas_Object *obj;
_smart_init();
return evas_object_smart_add(evas, _e_smart);
obj = evas_object_smart_add(evas, _e_smart);
elm_widget_mirrored_set(obj, elm_mirrored_get());
return obj;
}
EAPI void
@ -527,6 +531,37 @@ elm_widget_focus_next_hook_set(Evas_Object *obj, Eina_Bool (*func) (const Evas_O
sd->focus_next_func = func;
}
/**
* Returns the widget's mirrored mode.
*
* @param obj The widget.
* @return mirrored mode of the object.
*
**/
EAPI Eina_Bool
elm_widget_mirrored_get(const Evas_Object *obj)
{
API_ENTRY return EINA_FALSE;
return sd->is_mirrored;
}
/**
* Sets the widget's mirrored mode.
*
* @param obj The widget.
* @param mirrored EINA_TRUE to set mirrored mode. EINA_FALSE to unset.
*/
EAPI void
elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
{
API_ENTRY return;
if (sd->is_mirrored != mirrored)
{
sd->is_mirrored = mirrored;
elm_widget_theme(obj);
}
}
EAPI void
elm_widget_on_focus_hook_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj), void *data)
{
@ -615,6 +650,7 @@ elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj)
API_ENTRY return;
double scale, pscale = elm_widget_scale_get(sobj);
Elm_Theme *th, *pth = elm_widget_theme_get(sobj);
Eina_Bool mirrored, pmirrored = elm_widget_mirrored_get(obj);
if (_elm_widget_is(sobj))
{
@ -646,7 +682,8 @@ elm_widget_sub_object_add(Evas_Object *obj, Evas_Object *sobj)
evas_object_smart_callback_call(obj, "sub-object-add", sobj);
scale = elm_widget_scale_get(sobj);
th = elm_widget_theme_get(sobj);
if ((scale != pscale) || (th != pth)) elm_widget_theme(sobj);
mirrored = elm_widget_mirrored_get(sobj);
if ((scale != pscale) || (th != pth) || (pmirrored != mirrored)) elm_widget_theme(sobj);
if (elm_widget_focus_get(sobj)) _focus_parents(obj);
}

View File

@ -279,6 +279,8 @@ EAPI void elm_widget_scale_set(Evas_Object *obj, double scale);
EAPI double elm_widget_scale_get(const Evas_Object *obj);
EAPI void elm_widget_theme_set(Evas_Object *obj, Elm_Theme *th);
EAPI Elm_Theme *elm_widget_theme_get(const Evas_Object *obj);
EAPI Eina_Bool elm_widget_mirrored_get(const Evas_Object *obj);
EAPI void elm_widget_mirrored_set(Evas_Object *obj, Eina_Bool mirrored);
EAPI void elm_widget_style_set(Evas_Object *obj, const char *style);
EAPI const char *elm_widget_style_get(const Evas_Object *obj);
EAPI void elm_widget_type_set(Evas_Object *obj, const char *type);