[Libreoffice-commits] core.git: 2 commits - svtools/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Sun Dec 28 06:55:41 PST 2014


 svtools/source/control/tabbar.cxx |   42 +++++++++++++++++++++++++++-----------
 1 file changed, 30 insertions(+), 12 deletions(-)

New commits:
commit 9bfeeee0aac88d8215525a2a18280b5183b03b7f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Dec 28 23:52:39 2014 +0900

    Rework TabBar D&D tab move triangles and make them HiDPI aware
    
    Change-Id: Ia4165880b0b08b5ca26fe7004f961cd17b3d3e27

diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 0cdd494..d55a3cb 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -2577,9 +2577,13 @@ sal_uInt16 TabBar::ShowDropPos( const Point& rPos )
     long        nY = (maWinSize.Height()/2)-1;
     sal_uInt16      nCurPos = GetPagePos( mnCurPageId );
 
-    SetLineColor( aBlackColor );
+    sal_Int32 nTriangleWidth = 3 * GetDPIScaleFactor();
+
     if ( mnDropPos < nItemCount )
     {
+        SetLineColor(aBlackColor);
+        SetFillColor(aBlackColor);
+
         pItem = (*mpItemList)[ mnDropPos ];
         nX = pItem->maRect.Left();
         if ( mnDropPos == nCurPos )
@@ -2587,23 +2591,36 @@ sal_uInt16 TabBar::ShowDropPos( const Point& rPos )
         else
             nX++;
         if ( !pItem->IsDefaultTabBgColor() && !pItem->mbSelect)
-            SetLineColor( pItem->maTabTextColor );
-        DrawLine( Point( nX, nY ), Point( nX, nY ) );
-        DrawLine( Point( nX+1, nY-1 ), Point( nX+1, nY+1 ) );
-        DrawLine( Point( nX+2, nY-2 ), Point( nX+2, nY+2 ) );
-        SetLineColor( aBlackColor );
+        {
+            SetLineColor(pItem->maTabTextColor);
+            SetFillColor(pItem->maTabTextColor);
+        }
+
+        Polygon aPoly(3);
+        aPoly.SetPoint(Point(nX, nY), 0);
+        aPoly.SetPoint(Point(nX + nTriangleWidth, nY - nTriangleWidth), 1);
+        aPoly.SetPoint(Point(nX + nTriangleWidth, nY + nTriangleWidth), 2);
+        DrawPolygon(aPoly);
     }
     if ( (mnDropPos > 0) && (mnDropPos < nItemCount+1) )
     {
+        SetLineColor(aBlackColor);
+        SetFillColor(aBlackColor);
+
         pItem = (*mpItemList)[ mnDropPos-1 ];
         nX = pItem->maRect.Right();
         if ( mnDropPos == nCurPos )
             nX++;
         if ( !pItem->IsDefaultTabBgColor() && !pItem->mbSelect)
-            SetLineColor( pItem->maTabTextColor );
-        DrawLine( Point( nX, nY ), Point( nX, nY ) );
-        DrawLine( Point( nX-1, nY-1 ), Point( nX-1, nY+1 ) );
-        DrawLine( Point( nX-2, nY-2 ), Point( nX-2, nY+2 ) );
+        {
+            SetLineColor(pItem->maTabTextColor);
+            SetFillColor(pItem->maTabTextColor);
+        }
+        Polygon aPoly(3);
+        aPoly.SetPoint(Point(nX, nY ), 0);
+        aPoly.SetPoint(Point(nX - nTriangleWidth, nY - nTriangleWidth), 1);
+        aPoly.SetPoint(Point(nX - nTriangleWidth, nY + nTriangleWidth), 2);
+        DrawPolygon(aPoly);
     }
 
     return mnDropPos;
commit 37fa4e781dd0a0edccb59eaf5d8b624f15ef469a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Dec 28 22:38:28 2014 +0900

    HiDPI: TabBar resizer changes size depending on DPI scale factor
    
    Change-Id: I36a6d22f87b0d96cdbdadd683cd3abeb12e28c77

diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 4cf4e9a..0cdd494 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -167,8 +167,9 @@ ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle )
     : Window( pParent, nWinStyle & WB_3DLOOK )
     , mnStartWidth(0)
 {
-    SetPointer( Pointer( POINTER_HSIZEBAR ) );
-    SetSizePixel( Size( 7, 0 ) );
+    sal_Int32 nScaleFactor = GetDPIScaleFactor();
+    SetPointer(Pointer(POINTER_HSIZEBAR));
+    SetSizePixel(Size(7 * nScaleFactor, 0));
 }
 
 


More information about the Libreoffice-commits mailing list