Alexandre Julliard : wrc: Set the WS_EX_LAYOUTRTL flag when translating a dialog to a RTL language.

Alexandre Julliard julliard at winehq.org
Mon Oct 31 12:49:04 CDT 2011


Module: wine
Branch: master
Commit: f13f25343cc30a70e2fc595f7213a2014932f914
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f13f25343cc30a70e2fc595f7213a2014932f914

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Oct 31 11:22:23 2011 +0100

wrc: Set the WS_EX_LAYOUTRTL flag when translating a dialog to a RTL language.

---

 tools/wrc/po.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/tools/wrc/po.c b/tools/wrc/po.c
index f44c395..d93c1b7 100644
--- a/tools/wrc/po.c
+++ b/tools/wrc/po.c
@@ -59,6 +59,11 @@ static int is_english( const language_t *lan )
     return lan->id == LANG_ENGLISH && lan->sub == SUBLANG_DEFAULT;
 }
 
+static int is_rtl_language( const language_t *lan )
+{
+    return lan->id == LANG_ARABIC || lan->id == LANG_HEBREW || lan->id == LANG_PERSIAN;
+}
+
 static version_t *get_dup_version( language_t *lang )
 {
     /* English "translations" take precedence over the original rc contents */
@@ -674,6 +679,8 @@ static void compare_dialogs( const dialog_t *english_dlg, const dialog_t *dlg )
     if (dlg->gotexstyle) exstyle = dlg->exstyle->or_mask;
     if (english_dlg->gotstyle) english_style = english_dlg->style->or_mask;
     if (english_dlg->gotexstyle) english_exstyle = english_dlg->exstyle->or_mask;
+    if (is_rtl_language( dlg->lvc.language )) english_exstyle |= WS_EX_LAYOUTRTL;
+
     if (english_style != style)
         warning( "%s: dialog %s doesn't have the same style (%08x vs %08x)\n",
                  get_language_name( dlg->lvc.language ), title, style, english_style );
@@ -1061,6 +1068,14 @@ static stringtable_t *translate_stringtable( stringtable_t *stt, language_t *lan
 static void translate_dialog( dialog_t *dlg, dialog_t *new, int *found )
 {
     if (dlg->title) new->title = translate_string( dlg->title, found );
+    if (is_rtl_language( new->lvc.language ))
+    {
+        new->gotexstyle = TRUE;
+        if (dlg->gotexstyle)
+            new->exstyle = new_style( dlg->exstyle->or_mask | WS_EX_LAYOUTRTL, dlg->exstyle->and_mask );
+        else
+            new->exstyle = new_style( WS_EX_LAYOUTRTL, 0 );
+    }
     if (dlg->font)
     {
         new->font = xmalloc( sizeof(*dlg->font) );




More information about the wine-cvs mailing list