[Libreoffice-commits] core.git: vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Mon May 18 04:18:54 PDT 2015


 vcl/source/window/splitwin.cxx |  149 +++++++++++++++--------------------------
 1 file changed, 58 insertions(+), 91 deletions(-)

New commits:
commit b951771244d511c140a7c84181a1e160d9ef97c1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun May 17 22:19:02 2015 +0900

    tdf#83527 change split window expande handle to be more visible
    
    Change-Id: Ic881c7476fb7e64b7e13b64d3a5ba16403cc796e

diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index df362cd..4b35a84 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -137,11 +137,11 @@ namespace {
     }
 }
 
-#define SPLITWIN_SPLITSIZE              3
+#define SPLITWIN_SPLITSIZE              4
 #define SPLITWIN_SPLITSIZEEX            4
-#define SPLITWIN_SPLITSIZEEXLN          6
-#define SPLITWIN_SPLITSIZEAUTOHIDE      36
-#define SPLITWIN_SPLITSIZEFADE          36
+#define SPLITWIN_SPLITSIZEEXLN          7
+#define SPLITWIN_SPLITSIZEAUTOHIDE      72
+#define SPLITWIN_SPLITSIZEFADE          72
 
 #define SPLIT_HORZ              ((sal_uInt16)0x0001)
 #define SPLIT_VERT              ((sal_uInt16)0x0002)
@@ -1850,118 +1850,85 @@ void SplitWindow::ImplDrawAutoHide(vcl::RenderContext& rRenderContext, bool bInP
     }
 }
 
-void SplitWindow::ImplDrawFadeArrow(vcl::RenderContext& rRenderContext, const Point& rPt, bool bHorz, bool bLeft)
+void SplitWindow::ImplDrawGrip(vcl::RenderContext& rRenderContext, const Rectangle& rRect, bool bHorizontal, bool bLeft)
 {
     const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
 
-    int x(rPt.X());
-    int y(rPt.Y());
+    Color aColor;
 
-    Color aCol;
-    if (!bHorz)
+    if (rRect.IsInside(GetPointerPosPixel()))
     {
-        int dx = 1;
-        if (bLeft)
-        {
-            x++;
-            dx = -1;
-        }
-
-        x++;
-        y++;
-        aCol = Color( COL_WHITE );
-        rRenderContext.DrawPixel( Point(x, y), aCol );
-        rRenderContext.DrawPixel( Point(x, y+1), aCol );
-        rRenderContext.DrawPixel( Point(x, y+2), aCol );
-        rRenderContext.DrawPixel( Point(x+dx, y+1), aCol );
+        vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, rRect, 2, false, false, false);
 
-        x--; y--;
-        aCol = rStyleSettings.GetDarkShadowColor();
-        rRenderContext.DrawPixel( Point(x, y), rStyleSettings.GetDarkShadowColor() );
-        rRenderContext.DrawPixel( Point(x, y+1), rStyleSettings.GetDarkShadowColor() );
-        rRenderContext.DrawPixel( Point(x, y+2), rStyleSettings.GetDarkShadowColor() );
-        rRenderContext.DrawPixel( Point(x+dx, y+1), rStyleSettings.GetDarkShadowColor() );
+        aColor = rStyleSettings.GetDarkShadowColor();
     }
     else
     {
-        int dy = 1;
-        if (bLeft)
-        {
-            y++;
-            dy = -1;
-        }
+        rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor());
+        rRenderContext.SetFillColor(rStyleSettings.GetDarkShadowColor());
 
-        x++; y++;
-        aCol = Color( COL_WHITE );
-        rRenderContext.DrawPixel( Point(x, y), aCol );
-        rRenderContext.DrawPixel( Point(x+1, y), aCol );
-        rRenderContext.DrawPixel( Point(x+2, y), aCol );
-        rRenderContext.DrawPixel( Point(x+1, y+dy), aCol );
+        rRenderContext.DrawRect(rRect);
 
-        x--; y--;
-        aCol = rStyleSettings.GetDarkShadowColor();
-        rRenderContext.DrawPixel( Point(x, y), aCol );
-        rRenderContext.DrawPixel( Point(x+1, y), aCol );
-        rRenderContext.DrawPixel( Point(x+2, y), aCol );
-        rRenderContext.DrawPixel( Point(x+1, y+dy), aCol );
+        aColor = rStyleSettings.GetFaceColor();
     }
-}
 
-void SplitWindow::ImplDrawGrip(vcl::RenderContext& rRenderContext, const Rectangle& rRect, bool bHorz, bool bLeft )
-{
-    const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+    sal_uInt16 nAA = rRenderContext.GetAntialiasing();
+    rRenderContext.SetAntialiasing(nAA | ANTIALIASING_PIXELSNAPHAIRLINE | ANTIALIASING_ENABLE_B2DDRAW);
 
-    if (rRect.IsInside(GetPointerPosPixel()))
-    {
-        rRenderContext.DrawWallpaper(rRect, Wallpaper(Color(COL_WHITE)));
-        vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, rRect, 2, false, false, false);
-    }
+    long nWidth = rRect.getWidth();
+    long nWidthHalf = nWidth / 2;
+    long nHeight = rRect.getHeight();
+    long nHeightHalf = nHeight / 2;
 
-    if (bHorz)
-    {
-        int width = (int) (0.5 * rRect.getWidth() + 0.5);
-        int i = rRect.Left() + (rRect.getWidth() - width) / 2;
-        width += i;
-        const int y = rRect.Top() + 1;
-        ImplDrawFadeArrow(rRenderContext, Point( i-8, y), bHorz, bLeft);
-        while( i <= width )
-        {
+    long nLeft = rRect.Left();
+    long nRight = rRect.Right();
+    long nTop = rRect.Top();
+    long nBottom = rRect.Bottom();
+    long nMargin = 1;
+
+    rRenderContext.SetLineColor(aColor);
+    rRenderContext.SetFillColor(aColor);
 
-            rRenderContext.DrawPixel(Point(i, y), rStyleSettings.GetDarkShadowColor());
-            rRenderContext.DrawPixel(Point(i+1, y), rStyleSettings.GetShadowColor());
+    Polygon aPoly(3);
 
-            rRenderContext.DrawPixel(Point(i, y+1), rStyleSettings.GetShadowColor());
-            rRenderContext.DrawPixel(Point(i+1, y+1), rStyleSettings.GetFaceColor());
-            rRenderContext.DrawPixel(Point(i+2, y+1), Color(COL_WHITE));
+    if (bHorizontal)
+    {
+        long nCenter = nLeft + nWidthHalf;
 
-            rRenderContext.DrawPixel(Point(i+1, y+2), Color(COL_WHITE));
-            rRenderContext.DrawPixel(Point(i+2, y+2), Color(COL_WHITE));
-            i+=4;
+        if (bLeft)
+        {
+            aPoly.SetPoint(Point(nCenter,               nTop    + nMargin), 0);
+            aPoly.SetPoint(Point(nCenter - nHeightHalf, nBottom - nMargin), 1);
+            aPoly.SetPoint(Point(nCenter - nHeightHalf, nBottom - nMargin), 2);
+        }
+        else
+        {
+            aPoly.SetPoint(Point(nCenter,               nBottom - nMargin), 0);
+            aPoly.SetPoint(Point(nCenter - nHeightHalf, nTop    + nMargin), 1);
+            aPoly.SetPoint(Point(nCenter + nHeightHalf, nTop    + nMargin), 2);
         }
-        ImplDrawFadeArrow(rRenderContext, Point(i + 3, y), bHorz, bLeft);
+        rRenderContext.DrawPolygon(aPoly);
     }
     else
     {
-        int height = (int) (0.5 * rRect.getHeight() + 0.5);
-        int i = rRect.Top() + (rRect.getHeight() - height) / 2;
-        height += i;
-        const int x = rRect.Left() + 2;
-        ImplDrawFadeArrow(rRenderContext, Point(x, i - 8), bHorz, bLeft);
-        while (i <= height)
-        {
-            DrawPixel(Point(x, i), rStyleSettings.GetDarkShadowColor());
-            DrawPixel(Point(x+1, i), rStyleSettings.GetShadowColor());
-
-            DrawPixel(Point(x, i+1), rStyleSettings.GetShadowColor());
-            DrawPixel(Point(x+1, i+1), rStyleSettings.GetFaceColor());
-            DrawPixel(Point(x+2, i+1), Color(COL_WHITE));
+        long nCenter = nTop + nHeightHalf;
 
-            DrawPixel(Point(x+1, i+2), Color(COL_WHITE));
-            DrawPixel(Point(x+2, i+2), Color(COL_WHITE));
-            i+=4;
+        if (bLeft)
+        {
+            aPoly.SetPoint(Point(nLeft  + nMargin, nCenter), 0);
+            aPoly.SetPoint(Point(nRight - nMargin, nCenter - nWidthHalf), 1);
+            aPoly.SetPoint(Point(nRight - nMargin, nCenter + nWidthHalf), 2);
         }
-        ImplDrawFadeArrow(rRenderContext, Point(x, i + 3), bHorz, bLeft);
+        else
+        {
+            aPoly.SetPoint(Point(nRight - nMargin, nCenter), 0);
+            aPoly.SetPoint(Point(nLeft  + nMargin, nCenter - nWidthHalf), 1);
+            aPoly.SetPoint(Point(nLeft  + nMargin, nCenter + nWidthHalf), 2);
+        }
+        rRenderContext.DrawPolygon(aPoly);
     }
+
+    rRenderContext.SetAntialiasing(nAA);
 }
 
 void SplitWindow::ImplDrawFadeIn(vcl::RenderContext& rRenderContext, bool bInPaint)


More information about the Libreoffice-commits mailing list