vcl/inc/vcl/salnativewidgets.hxx              |    3 -
 vcl/source/window/toolbox.cxx                 |    5 +-
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx      |   57 ++++++++++++++++----------
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |   30 ++++++-------
 4 files changed, 57 insertions(+), 38 deletions(-)

New commits:
commit f1005e50e795a06b5504960a94e529b48e085a91
Author: Ivan Timofeev <timofeev....@gmail.com>
Date:   Sat May 5 20:07:41 2012 +0400

    gtk: fix drawing of separators in vertical toolbars
    
    (regression from 0377b99b3f50a67e7845a3d728313e5a2ef36e73)
    
    * divide PART_SEPARATOR into PART_SEPARATOR_HORZ and PART_SEPARATOR_VERT
    * improve separator reduction: now the offset is (height*0.2) instead of 7.
    * rename: gVSeparator -> gSeparator
    * remove trailing whitespace
    
    Change-Id: I I If144509d7e061bf1b7901cd5418c4d7dbc3aa0d0

diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx
index 872fa35..c082b38 100644
--- a/vcl/inc/vcl/salnativewidgets.hxx
+++ b/vcl/inc/vcl/salnativewidgets.hxx
@@ -165,7 +165,8 @@ typedef sal_uInt32      ControlPart;
 #define PART_BUTTON_LEFT            103
 #define PART_BUTTON_RIGHT           104
 #define PART_ALL_BUTTONS            105
-#define PART_SEPARATOR              106
+#define PART_SEPARATOR_HORZ         106
+#define PART_SEPARATOR_VERT         107
 #define PART_TRACK_HORZ_LEFT        200
 #define PART_TRACK_VERT_UPPER       201
 #define PART_TRACK_HORZ_RIGHT       202
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index adc31cc..e02e3ac 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3239,11 +3239,12 @@ void ToolBox::ImplDrawSeparator( sal_uInt16 nPos, 
Rectangle rRect )
     bool bNativeOk = false;
     ImplToolItem* pItem = &mpData->m_aItems[nPos];
 
-    if( IsNativeControlSupported( CTRL_TOOLBAR, PART_SEPARATOR ) )
+    ControlPart nPart = IsHorizontal() ? PART_SEPARATOR_VERT : 
PART_SEPARATOR_HORZ;
+    if( IsNativeControlSupported( CTRL_TOOLBAR, nPart ) )
     {
         ImplControlValue    aControlValue;
         ControlState        nState = 0;
-        bNativeOk = DrawNativeControl( CTRL_TOOLBAR, PART_SEPARATOR,
+        bNativeOk = DrawNativeControl( CTRL_TOOLBAR, nPart,
                                        rRect, nState, aControlValue, 
rtl::OUString() );
     }
 
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx 
b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 7c06d6a..b2b6d7c 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -107,7 +107,7 @@ struct NWFWidgetData
     GtkWidget *  gTreeView;
     GtkWidget *  gHScale;
     GtkWidget *  gVScale;
-    GtkWidget *  gVSeparator;
+    GtkWidget *  gSeparator;
 
     NWPixmapCacheList* gNWPixmapCacheList;
     NWPixmapCache* gCacheTabItems;
@@ -146,7 +146,7 @@ struct NWFWidgetData
         gTreeView( NULL ),
         gHScale( NULL ),
         gVScale( NULL ),
-        gVSeparator ( NULL ),
+        gSeparator( NULL ),
         gNWPixmapCacheList( NULL ),
         gCacheTabItems( NULL ),
         gCacheTabPages( NULL )
@@ -579,7 +579,8 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( 
ControlType nType, ControlPar
                 ||  (nPart==PART_THUMB_HORZ)
                 ||  (nPart==PART_THUMB_VERT)
                 ||  (nPart==PART_BUTTON)
-                ||  (nPart==PART_SEPARATOR)
+                ||  (nPart==PART_SEPARATOR_HORZ)
+                ||  (nPart==PART_SEPARATOR_VERT)
                 )
                                                                 )   ||
         ((nType == CTRL_MENUBAR) &&
@@ -2642,30 +2643,46 @@ sal_Bool GtkSalGraphics::NWPaintGTKToolbar(
                                   GTK_ORIENTATION_VERTICAL
                                   );
             }
-            else if(nPart == PART_SEPARATOR )
+            else if( nPart == PART_SEPARATOR_HORZ || nPart == 
PART_SEPARATOR_VERT )
             {
                 gint separator_height, separator_width, wide_separators;
 
-                gtk_widget_style_get (gWidgetData[m_nXScreen].gVSeparator,
+                gtk_widget_style_get (gWidgetData[m_nXScreen].gSeparator,
                                       "wide-separators",  &wide_separators,
                                       "separator-width",  &separator_width,
                                       "separator-height", &separator_height,
                                       NULL);
+
+                const double shim = 0.2;
+
                 if (wide_separators)
-                    gtk_paint_box (gWidgetData[m_nXScreen].gVSeparator->style, 
gdkDrawable,
-                               GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
-                               &clipRect, gWidgetData[m_nXScreen].gVSeparator, 
"vseparator",
-                               x + (w - separator_width) / 2,
-                               y + 7,
-                               separator_width,
-                               h - 14);
+                {
+                    if (nPart == PART_SEPARATOR_VERT)
+                        gtk_paint_box 
(gWidgetData[m_nXScreen].gSeparator->style, gdkDrawable,
+                                       GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
+                                       &clipRect, 
gWidgetData[m_nXScreen].gSeparator, "vseparator",
+                                       x + (w - separator_width) / 2, y + h * 
shim,
+                                       separator_width, h * (1 - 2*shim));
+                    else
+                        gtk_paint_box 
(gWidgetData[m_nXScreen].gSeparator->style, gdkDrawable,
+                                       GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
+                                       &clipRect, 
gWidgetData[m_nXScreen].gSeparator, "hseparator",
+                                       x + w * shim, y + (h - separator_width) 
/ 2,
+                                       w * (1 - 2*shim), separator_width);
+                }
                 else
-                    gtk_paint_vline 
(gWidgetData[m_nXScreen].gVSeparator->style, gdkDrawable,
-                                 GTK_STATE_NORMAL,
-                                 &clipRect, 
gWidgetData[m_nXScreen].gVSeparator, "vseparator",
-                                 y + 7,
-                                 y + h - 7,
-                                 x + w/2 - 1);
+                {
+                    if (nPart == PART_SEPARATOR_VERT)
+                        gtk_paint_vline 
(gWidgetData[m_nXScreen].gSeparator->style, gdkDrawable,
+                                         GTK_STATE_NORMAL,
+                                         &clipRect, 
gWidgetData[m_nXScreen].gSeparator, "vseparator",
+                                         y + h * shim, y + h * (1 - shim), x + 
w/2 - 1);
+                    else
+                        gtk_paint_hline 
(gWidgetData[m_nXScreen].gSeparator->style, gdkDrawable,
+                                         GTK_STATE_NORMAL,
+                                         &clipRect, 
gWidgetData[m_nXScreen].gSeparator, "hseparator",
+                                         x + w * shim, x + w * (1 - shim), y + 
h/2 - 1);
+                }
             }
         }
     }
@@ -3972,8 +3989,8 @@ static void NWEnsureGTKToolbar( SalX11Screen nScreen )
         gWidgetData[nScreen].gToolbarWidget = gtk_toolbar_new();
         NWAddWidgetToCacheWindow( gWidgetData[nScreen].gToolbarWidget, nScreen 
);
         gWidgetData[nScreen].gToolbarButtonWidget = 
GTK_WIDGET(gtk_button_new());
-        gWidgetData[nScreen].gVSeparator = 
GTK_WIDGET(gtk_separator_tool_item_new());
-        NWAddWidgetToCacheWindow( gWidgetData[nScreen].gVSeparator, nScreen );
+        gWidgetData[nScreen].gSeparator = 
GTK_WIDGET(gtk_separator_tool_item_new());
+        NWAddWidgetToCacheWindow( gWidgetData[nScreen].gSeparator, nScreen );
 
         GtkReliefStyle aRelief = GTK_RELIEF_NORMAL;
         gtk_widget_ensure_style( gWidgetData[nScreen].gToolbarWidget );
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx 
b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 6bd2280..726821d 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -68,7 +68,7 @@ static void NWConvertVCLStateToGTKState( ControlState 
nVCLState,
         *nGTKState = (GtkStateFlags) (*nGTKState | GTK_STATE_FLAG_ACTIVE);
         *nGTKShadow = GTK_SHADOW_IN;
     }
-    
+
     if ( nVCLState & CTRL_STATE_ROLLOVER )
         *nGTKState = (GtkStateFlags) (*nGTKState | GTK_STATE_FLAG_PRELIGHT);
 
@@ -191,7 +191,7 @@ Rectangle GtkSalGraphics::NWGetScrollButtonRect( 
ControlPart nPart, Rectangle aA
                                  "stepper-size", &stepper_size,
                                  "trough-border", &trough_border,
                                  "stepper-spacing", &stepper_spacing, (char 
*)NULL );
-  
+
     gboolean has_forward;
     gboolean has_forward2;
     gboolean has_backward;
@@ -423,7 +423,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext 
*context,
     gtk_render_background(context, cr, x, y,
                           scrollbarRect.GetWidth(), scrollbarRect.GetHeight() 
);
     gtk_render_frame(context, cr, x, y,
-                     scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );    
+                     scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );
 
     gtk_style_context_restore(context);
 
@@ -431,14 +431,14 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext 
*context,
     if ( has_slider )
     {
         NWConvertVCLStateToGTKState( pScrollbarVal->mnThumbState, &stateFlags, 
&shadowType );
-        if ( pScrollbarVal->mnThumbState & CTRL_STATE_PRESSED )  
+        if ( pScrollbarVal->mnThumbState & CTRL_STATE_PRESSED )
             stateFlags = (GtkStateFlags) (stateFlags | GTK_STATE_PRELIGHT);
 
         gtk_style_context_save(context);
         gtk_style_context_set_state(context, stateFlags);
         gtk_style_context_add_class(context, GTK_STYLE_CLASS_SLIDER);
 
-        gtk_render_slider(context, cr, 
+        gtk_render_slider(context, cr,
                           x+hShim+thumbRect.Left(), y+vShim+thumbRect.Top(),
                           thumbRect.GetWidth(), thumbRect.GetHeight(), 
scrollbarOrientation);
 
@@ -1059,7 +1059,7 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( 
ControlType nType, ControlPart
             aEditRect = Rectangle( Point( 0, point / 2),
                                    Size( indicator_size, indicator_size ) );
         }
-    } 
+    }
     else if (nPart == PART_MENU_SEPARATOR)
     {
         switch (nType)
@@ -1094,24 +1094,24 @@ sal_Bool GtkSalGraphics::getNativeControlRegion( 
ControlType nType, ControlPart
                                    Size( arrow_size, arrow_size ) );
         }
     }
-    else if ( (nType==CTRL_SCROLLBAR) && 
+    else if ( (nType==CTRL_SCROLLBAR) &&
               ((nPart==PART_BUTTON_LEFT) || (nPart==PART_BUTTON_RIGHT) ||
                (nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN)  ) )
     {
         aEditRect = NWGetScrollButtonRect( nPart, rControlRegion );
-    } 
-    else if ( (nType==CTRL_SPINBOX) && 
+    }
+    else if ( (nType==CTRL_SPINBOX) &&
               ((nPart==PART_BUTTON_UP) || (nPart==PART_BUTTON_DOWN) ||
                (nPart==PART_SUB_EDIT)) )
     {
         aEditRect = NWGetSpinButtonRect( nPart, rControlRegion );
     }
-    else if ( (nType==CTRL_COMBOBOX) && 
+    else if ( (nType==CTRL_COMBOBOX) &&
               ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) )
     {
         aEditRect = NWGetComboBoxButtonRect( nType, nPart, rControlRegion );
     }
-    else if ( (nType==CTRL_LISTBOX) && 
+    else if ( (nType==CTRL_LISTBOX) &&
               ((nPart==PART_BUTTON_DOWN) || (nPart==PART_SUB_EDIT)) )
     {
         aEditRect = NWGetComboBoxButtonRect( nType, nPart, rControlRegion );
@@ -1460,7 +1460,7 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( 
ControlType nType, ControlPar
        (nType == CTRL_PUSHBUTTON && nPart == PART_ENTIRE_CONTROL) ||
        (nType == CTRL_CHECKBOX && nPart == PART_ENTIRE_CONTROL) ||
        (nType == CTRL_RADIOBUTTON && nPart == PART_ENTIRE_CONTROL) |
-       (nType == CTRL_TOOLBAR && 
+       (nType == CTRL_TOOLBAR &&
         (nPart == PART_BUTTON || nPart == PART_ENTIRE_CONTROL)) ||
         ((nType == CTRL_SPINBOX) &&
          ((nPart == PART_ENTIRE_CONTROL) || (nPart == PART_ALL_BUTTONS) ||
@@ -1475,7 +1475,7 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( 
ControlType nType, ControlPar
         ( (nPart == PART_DRAW_BACKGROUND_HORZ) || (nPart == 
PART_DRAW_BACKGROUND_VERT) ||
           (nPart == PART_ENTIRE_CONTROL) || (nPart == HAS_THREE_BUTTONS))) ||
        (nType == CTRL_MENU_POPUP &&
-        ((nPart == PART_MENU_ITEM_CHECK_MARK) || (nPart == 
PART_MENU_ITEM_RADIO_MARK) || 
+        ((nPart == PART_MENU_ITEM_CHECK_MARK) || (nPart == 
PART_MENU_ITEM_RADIO_MARK) ||
          (nPart == PART_MENU_SEPARATOR) || (nPart == 
PART_MENU_SUBMENU_ARROW))))
         return sal_True;
 
@@ -1504,7 +1504,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, 
GtkWidget *pWindow )
         return;
 
     GtkWidgetPath* path;
- 
+
     style_loaded = true;
     gtk_init(NULL, NULL);
     /* Load the GtkStyleContexts, it might be a bit slow, but usually,
@@ -1513,7 +1513,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, 
GtkWidget *pWindow )
     getStyleContext(&mpEntryStyle, gtk_entry_new());
     getStyleContext(&mpButtonStyle, gtk_button_new());
 
-    getStyleContext(&mpToolbarStyle, gtk_toolbar_new());    
+    getStyleContext(&mpToolbarStyle, gtk_toolbar_new());
     gtk_style_context_add_class(mpToolbarStyle, 
GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
     gtk_style_context_add_class(mpToolbarStyle, GTK_STYLE_CLASS_TOOLBAR);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to