[Libreoffice-commits] .: Branch 'libreoffice-3-6' - 2 commits - vcl/inc vcl/source vcl/unx

Fridrich Strba fridrich at kemper.freedesktop.org
Fri Jun 15 06:24:32 PDT 2012


 vcl/inc/unx/gtk/gtkgdi.hxx               |    5 ++
 vcl/source/window/decoview.cxx           |   11 +++++
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx |   61 ++++++++++++++++++++++++++++---
 3 files changed, 73 insertions(+), 4 deletions(-)

New commits:
commit fd9827e7353111563b91f66b3dfe3f54a61628e2
Author: Ruslan Kabatsayev <b7.10110111 at gmail.com>
Date:   Thu Jun 7 03:54:43 2012 +0400

    Implement native FixedLine render, add GTK support for it
    
    Change-Id: I142cc8c48331aaed0d157b4b0f81e7c021005624
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index b4fe837..a8d6584 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -165,6 +165,11 @@ protected:
     GdkPixmap* NWGetPixmapFromScreen( Rectangle srcRect );
     sal_Bool NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect );
 
+    sal_Bool NWPaintGTKFixedLine( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
+                           const Rectangle& rControlRectangle,
+                           const clipList& rClipList,
+                           ControlState nState, const ImplControlValue& aValue,
+                           const OUString& rCaption );
     sal_Bool NWPaintGTKFrame( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
                            const Rectangle& rControlRectangle,
                            const clipList& rClipList,
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 381043e..3e85e2e 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -1087,6 +1087,17 @@ void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, boo
 {
     Point aStart( rStart ), aStop( rStop );
     const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
+    Window *const pWin = (mpOutDev->GetOutDevType()==OUTDEV_WINDOW) ? (Window*) mpOutDev: NULL;
+    if(pWin)
+    {
+        ControlPart nPart = ( bVertical ? PART_SEPARATOR_VERT : PART_SEPARATOR_HORZ );
+        bool nativeSupported = pWin->IsNativeControlSupported( CTRL_FIXEDLINE, nPart );
+        ImplControlValue    aValue;
+        ControlState        nState = 0;
+        Rectangle aRect(rStart,rStop);
+        if(nativeSupported && pWin->DrawNativeControl(CTRL_FIXEDLINE,nPart,aRect,nState,aValue,rtl::OUString()))
+            return;
+    }
 
     mpOutDev->Push( PUSH_LINECOLOR );
     if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 6ffbb8c..2b5d3c8 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -635,6 +635,11 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar
             if(nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA)
                 return true;
             break;
+
+        case CTRL_FIXEDLINE:
+            if(nPart == PART_SEPARATOR_VERT || nPart == PART_SEPARATOR_HORZ)
+                return true;
+            break;
     }
 
     return false;
@@ -921,6 +926,10 @@ sal_Bool GtkSalGraphics::drawNativeControl(    ControlType nType,
     {
         returnVal = NWPaintGTKWindowBackground( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
     }
+    else if( nType == CTRL_FIXEDLINE )
+    {
+        returnVal = NWPaintGTKFixedLine( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
+    }
 
     if(nType==CTRL_FRAME)
     {
@@ -1187,6 +1196,22 @@ sal_Bool GtkSalGraphics::getNativeControlRegion(  ControlType nType,
 /************************************************************************
  * Individual control drawing functions
  ************************************************************************/
+sal_Bool GtkSalGraphics::NWPaintGTKFixedLine(
+            GdkDrawable* gdkDrawable,
+            ControlType, ControlPart nPart,
+            const Rectangle& rControlRectangle,
+            const clipList&,
+            ControlState, const ImplControlValue&,
+            const OUString& )
+{
+    if(nPart == PART_SEPARATOR_HORZ)
+        gtk_paint_hline(m_pWindow->style,gdkDrawable,GTK_STATE_NORMAL,NULL,m_pWindow,"hseparator",rControlRectangle.Left(),rControlRectangle.Right(),rControlRectangle.Top());
+    else
+        gtk_paint_vline(m_pWindow->style,gdkDrawable,GTK_STATE_NORMAL,NULL,m_pWindow,"vseparator",rControlRectangle.Top(),rControlRectangle.Bottom(),rControlRectangle.Left());
+
+    return true;
+}
+
 sal_Bool GtkSalGraphics::NWPaintGTKFrame(
             GdkDrawable* gdkDrawable,
             ControlType, ControlPart,
commit 2406d170111a3859c34735c304e435832ecd108f
Author: Ruslan Kabatsayev <b7.10110111 at gmail.com>
Date:   Wed Jun 6 19:40:23 2012 +0400

    Render bg correctly for widgets without theme-visible position
    
    Change-Id: I8c9d2a86ee545788d40a27538e583a8dac21095f
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index b21f12c..6ffbb8c 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -1813,10 +1813,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKScrollbar( ControlType, ControlPart nPart,
                                         x, y, w, h );
 
     // ----------------- TROUGH
-    gtk_paint_flat_box( m_pWindow->style, gdkDrawable,
+    // Pass coordinates of draw rect: window(0,0) -> widget(bottom-right) (coords relative to widget)
+    gtk_paint_flat_box(m_pWindow->style, gdkDrawable,
                         GTK_STATE_NORMAL, GTK_SHADOW_NONE, gdkRect,
-                        m_pWindow, "base", x, y,
-                        w, h );
+                        m_pWindow, "base", x-pixmapRect.Left(),y-pixmapRect.Top(),x+pixmapRect.Right(),y+pixmapRect.Bottom());
+
     gtk_paint_box( style, gdkDrawable, GTK_STATE_ACTIVE, GTK_SHADOW_IN,
                    gdkRect, GTK_WIDGET(scrollbarWidget), "trough",
                    x, y,
@@ -2179,6 +2180,13 @@ sal_Bool GtkSalGraphics::NWPaintGTKSpinBox( ControlType nType, ControlPart nPart
     if ( !pixmap )
         return( sal_False );
 
+    // First render background
+    gtk_paint_flat_box(m_pWindow->style,pixmap,GTK_STATE_NORMAL,GTK_SHADOW_NONE,NULL,m_pWindow,"base",
+            -pixmapRect.Left(),
+            -pixmapRect.Top(),
+            pixmapRect.Right(),
+            pixmapRect.Bottom() );
+
     upBtnRect = NWGetSpinButtonRect( m_nXScreen, nType, upBtnPart, pixmapRect, upBtnState, aValue, rCaption );
     downBtnRect = NWGetSpinButtonRect( m_nXScreen, nType, downBtnPart, pixmapRect, downBtnState, aValue, rCaption );
 
@@ -2547,7 +2555,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
     paintRect.height = pixmapRect.GetHeight();
 
     gtk_paint_flat_box( m_pWindow->style, pixmap, GTK_STATE_NORMAL,
-                        GTK_SHADOW_NONE, &paintRect, m_pWindow, "base", 0, 0, -1, -1);
+                        GTK_SHADOW_NONE, &paintRect, m_pWindow, "base",
+                        -rControlRectangle.Left(),
+                        -rControlRectangle.Top(),
+                        pixmapRect.GetWidth()+rControlRectangle.Left(),
+                        pixmapRect.GetHeight()+rControlRectangle.Top());
 
     NWSetWidgetState( gWidgetData[m_nXScreen].gNotebookWidget, nState, stateType );
 
@@ -2563,8 +2575,18 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
             break;
 
         case CTRL_TAB_ITEM:
+        {
             stateType = ( nState & CTRL_STATE_SELECTED ) ? GTK_STATE_NORMAL : GTK_STATE_ACTIVE;
 
+            // First draw the background
+            gtk_paint_flat_box(gWidgetData[m_nXScreen].gNotebookWidget->style, pixmap,
+                                   GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, m_pWindow, "base",
+                                   -rControlRectangle.Left(),
+                                   -rControlRectangle.Top(),
+                                   pixmapRect.GetWidth()+rControlRectangle.Left(),
+                                   pixmapRect.GetHeight()+rControlRectangle.Top());
+
+            // Now the tab itself
             if( nState & CTRL_STATE_ROLLOVER )
                 g_object_set_data(G_OBJECT(pixmap),tabPrelitDataName,(gpointer)TRUE);
 
@@ -2580,6 +2602,7 @@ sal_Bool GtkSalGraphics::NWPaintGTKTabItem( ControlType nType, ControlPart,
                     "base", 0, (pixmapRect.GetHeight() - 1), pixmapRect.GetWidth(), 1 );
             }
             break;
+        }
 
         default:
             break;
@@ -3236,6 +3259,11 @@ sal_Bool GtkSalGraphics::NWPaintGTKProgress(
     GdkDrawable* const &pixDrawable = GDK_DRAWABLE( pixmap );
 
     // paint background
+    gtk_paint_flat_box(gWidgetData[m_nXScreen].gProgressBar->style, pixDrawable,
+                           GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, m_pWindow, "base",
+                           -rControlRectangle.Left(),-rControlRectangle.Top(),
+                           rControlRectangle.Left()+w,rControlRectangle.Top()+h);
+
     gtk_paint_flat_box( gWidgetData[m_nXScreen].gProgressBar->style,
                         pixDrawable,
                         GTK_STATE_NORMAL,


More information about the Libreoffice-commits mailing list