[Libreoffice-commits] .: 2 commits - vcl/unx

Tor Lillqvist tml at kemper.freedesktop.org
Mon Dec 5 03:09:07 PST 2011


 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx |   35 +++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)

New commits:
commit f8e53d7320aa3f1e7a543ee9f378a1ecd1a54490
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Fri Dec 2 22:27:05 2011 +0200

    gtk: fix RTL list box rendering

diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index cdd388d..f9e5906 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -3240,7 +3240,10 @@ static Rectangle NWGetListBoxButtonRect( int nScreen,
 
         case PART_SUB_EDIT:
             aPartSize.Width() = aAreaRect.GetWidth() - nButtonAreaWidth - xthickness;
-            aPartPos.X() = aAreaRect.Left() + xthickness;
+            if( Application::GetSettings().GetLayoutRTL() )
+                aPartPos.X() = aAreaRect.Left() + nButtonAreaWidth;
+            else
+                aPartPos.X() = aAreaRect.Left() + xthickness;
             break;
 
         default:
@@ -3274,6 +3277,7 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen,
     gint            width = 13;    // GTK+ default
     gint            height = 13;    // GTK+ default
     gint            right = 5;    // GTK+ default
+    gint            x;
 
     NWEnsureGTKOptionMenu( nScreen );
 
@@ -3291,8 +3295,11 @@ static Rectangle NWGetListBoxIndicatorRect( int nScreen,
         right = pIndicatorSpacing->right;
 
     aIndicatorRect.SetSize( Size( width, height ) );
-    aIndicatorRect.SetPos( Point( aAreaRect.Left() + aAreaRect.GetWidth() - width - right - gWidgetData[nScreen].gOptionMenuWidget->style->xthickness,
-                                  aAreaRect.Top() + ((aAreaRect.GetHeight() - height) / 2) ) );
+    if( Application::GetSettings().GetLayoutRTL() )
+        x = aAreaRect.Left() + right;
+    else
+        x = aAreaRect.Left() + aAreaRect.GetWidth() - width - right - gWidgetData[nScreen].gOptionMenuWidget->style->xthickness;
+    aIndicatorRect.SetPos( Point( x, aAreaRect.Top() + ((aAreaRect.GetHeight() - height) / 2) ) );
 
     // If height is odd, move the indicator down 1 pixel
     if ( aIndicatorRect.GetHeight() % 2 )
commit d2028f970bd527880c73f237678291d1bdc7cc89
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Fri Dec 2 14:10:32 2011 +0200

    gtk: fix RTL spin button rendering

diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 6afba20..cdd388d 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -2026,8 +2026,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart
     {
         // Draw an edit field for SpinBoxes and ComboBoxes
         Rectangle aEditBoxRect( pixmapRect );
-        aEditBoxRect.SetSize( Size( upBtnRect.Left() - pixmapRect.Left(), aEditBoxRect.GetHeight() ) );
-        aEditBoxRect.setX( 0 );
+        aEditBoxRect.SetSize( Size( pixmapRect.GetWidth() - upBtnRect.GetWidth(), aEditBoxRect.GetHeight() ) );
+        if( Application::GetSettings().GetLayoutRTL() )
+            aEditBoxRect.setX( upBtnRect.GetWidth() );
+        else
+            aEditBoxRect.setX( 0 );
         aEditBoxRect.setY( 0 );
 
         NWPaintOneEditBox( m_nScreen, pixmap, NULL, nType, nPart, aEditBoxRect, nState, aValue, rCaption );
@@ -2080,7 +2083,10 @@ static Rectangle NWGetSpinButtonRect( int nScreen,
     buttonSize -= buttonSize % 2 - 1; /* force odd */
     buttonRect.SetSize( Size( buttonSize + 2 * gWidgetData[nScreen].gSpinButtonWidget->style->xthickness,
                               buttonRect.GetHeight() ) );
-    buttonRect.setX( aAreaRect.Left() + (aAreaRect.GetWidth() - buttonRect.GetWidth()) );
+    if( Application::GetSettings().GetLayoutRTL() )
+        buttonRect.setX( aAreaRect.Left() );
+    else
+        buttonRect.setX( aAreaRect.Left() + (aAreaRect.GetWidth() - buttonRect.GetWidth()) );
     if ( nPart == PART_BUTTON_UP )
     {
         buttonRect.setY( aAreaRect.Top() );
@@ -2093,8 +2099,14 @@ static Rectangle NWGetSpinButtonRect( int nScreen,
     }
     else
     {
-        buttonRect.Right()  = buttonRect.Left()-1;
-        buttonRect.Left()   = aAreaRect.Left();
+        if( Application::GetSettings().GetLayoutRTL() ) {
+            buttonRect.Left()   = buttonRect.Right()+1;
+            buttonRect.Right()  = aAreaRect.Right();
+        } else {
+            printf("%ld\n", buttonRect.GetWidth());
+            buttonRect.Right()  = buttonRect.Left()-1;
+            buttonRect.Left()   = aAreaRect.Left();
+        }
         buttonRect.Top()    = aAreaRect.Top();
         buttonRect.Bottom() = aAreaRect.Bottom();
     }


More information about the Libreoffice-commits mailing list