[Libreoffice-commits] core.git: 6 commits - sc/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Mon Feb 23 06:51:03 PST 2015


 sc/source/ui/inc/tabsplit.hxx  |    1 
 sc/source/ui/view/gridwin.cxx  |   82 +++++++++++++++++++++++++++++++----------
 sc/source/ui/view/tabsplit.cxx |   56 +++++-----------------------
 sc/source/ui/view/tabview.cxx  |    6 ++-
 4 files changed, 78 insertions(+), 67 deletions(-)

New commits:
commit 8c693312f211a2046e433079cddaca811cae4a78
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon Feb 23 23:47:12 2015 +0900

    simplify drawing of splitter, add more flat look
    
    Change-Id: Ie5040c2932715b2505635ff3cb909ccfeb4b7fa0

diff --git a/sc/source/ui/view/tabsplit.cxx b/sc/source/ui/view/tabsplit.cxx
index 073aaf1..cebbeb0 100644
--- a/sc/source/ui/view/tabsplit.cxx
+++ b/sc/source/ui/view/tabsplit.cxx
@@ -65,17 +65,10 @@ void ScTabSplitter::Paint( const Rectangle& rRect )
         {
             case SC_SPLIT_NONE:
             {
-                // Draw 3D border
                 SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
-                DrawLine(rRect.TopRight(), rRect.BottomRight());
-                DrawLine(rRect.BottomLeft(), rRect.BottomRight());
-                SetLineColor(GetSettings().GetStyleSettings().GetLightColor());
-                DrawLine(rRect.TopLeft(), rRect.TopRight());
-                DrawLine(rRect.TopLeft(), rRect.BottomLeft());
-                // Fill internal rectangle
-                SetLineColor();
-                SetFillColor(GetSettings().GetStyleSettings().GetFaceColor());
-                DrawRect(Rectangle(rRect.Left()+1, rRect.Top()+1, rRect.Right()-1, rRect.Bottom()-1));
+                SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
+                DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
+
                 // Draw handle
                 SetLineColor(Color(COL_BLACK));
                 SetFillColor(Color(COL_BLACK));
@@ -87,13 +80,9 @@ void ScTabSplitter::Paint( const Rectangle& rRect )
                 break;
             }
             case SC_SPLIT_NORMAL:
-                SetLineColor(GetSettings().GetStyleSettings().GetLightColor());
-                DrawLine(rRect.TopLeft(), rRect.BottomLeft());
                 SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
-                DrawLine(rRect.TopRight(), rRect.BottomRight());
-                SetLineColor();
-                SetFillColor(GetSettings().GetStyleSettings().GetFaceColor());
-                DrawRect(Rectangle(Point(rRect.Left()+1, rRect.Top()), Point(rRect.Right()-1, rRect.Bottom())));
+                SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
+                DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
                 break;
             case SC_SPLIT_FIX:
                 // Nothing to draw
@@ -106,18 +95,11 @@ void ScTabSplitter::Paint( const Rectangle& rRect )
         {
             case SC_SPLIT_NONE:
             {
-                // Draw 3D border
                 SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
-                DrawLine(rRect.TopRight(), rRect.BottomRight());
-                DrawLine(rRect.BottomLeft(), rRect.BottomRight());
-                SetLineColor(GetSettings().GetStyleSettings().GetLightColor());
-                DrawLine(rRect.TopLeft(), rRect.TopRight());
-                DrawLine(rRect.TopLeft(), rRect.BottomLeft());
-                // Fill internal rectangle
-                SetLineColor();
-                SetFillColor(GetSettings().GetStyleSettings().GetFaceColor());
-                DrawRect(Rectangle(rRect.Left()+1, rRect.Top()+1, rRect.Right()-1, rRect.Bottom()-1));
-                // Draw handle
+                SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
+                DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
+
+                 // Draw handle
                 SetLineColor(Color(COL_BLACK));
                 SetFillColor(Color(COL_BLACK));
                 const long yc = rRect.Top()+rRect.Bottom();
@@ -128,13 +110,9 @@ void ScTabSplitter::Paint( const Rectangle& rRect )
                 break;
             }
             case SC_SPLIT_NORMAL:
-                SetLineColor(GetSettings().GetStyleSettings().GetLightColor());
-                DrawLine(rRect.TopLeft(), rRect.TopRight());
                 SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
-                DrawLine(rRect.BottomLeft(), rRect.BottomRight());
-                SetLineColor();
-                SetFillColor(GetSettings().GetStyleSettings().GetFaceColor());
-                DrawRect(Rectangle(Point(rRect.Left(), rRect.Top()+1), Point(rRect.Right(), rRect.Bottom()-1)));
+                SetFillColor(GetSettings().GetStyleSettings().GetShadowColor());
+                DrawRect(Rectangle(rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom()));
                 break;
             case SC_SPLIT_FIX:
                 // Nothing to draw
commit c750e1a92bad68c3518c1836f6a258a19be8b68c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon Feb 23 23:15:07 2015 +0900

    Remove changing the splitter position as it can cause an inf. loop
    
    Changing the splitter position can cause an infinite loop which is
    most likely a cause of a rounding error. This happens constantly
    when in HiDPI mode so remove it for now until a better solution is
    found.
    
    Change-Id: Id3551b41ea61c36a78f38a51a1fddfcfd104265a

diff --git a/sc/source/ui/inc/tabsplit.hxx b/sc/source/ui/inc/tabsplit.hxx
index a81e803..e2a5cb5 100644
--- a/sc/source/ui/inc/tabsplit.hxx
+++ b/sc/source/ui/inc/tabsplit.hxx
@@ -32,7 +32,6 @@ private:
 
 protected:
     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
-    virtual void    Splitting( Point& rSplitPos ) SAL_OVERRIDE;
 
 public:
                     ScTabSplitter( vcl::Window* pParent, WinBits nWinStyle,
diff --git a/sc/source/ui/view/tabsplit.cxx b/sc/source/ui/view/tabsplit.cxx
index 755aeef..073aaf1 100644
--- a/sc/source/ui/view/tabsplit.cxx
+++ b/sc/source/ui/view/tabsplit.cxx
@@ -43,18 +43,6 @@ void ScTabSplitter::MouseButtonDown( const MouseEvent& rMEvt )
         Splitter::MouseButtonDown( rMEvt );
 }
 
-void ScTabSplitter::Splitting( Point& rSplitPos )
-{
-    vcl::Window* pParent = GetParent();
-    Point aScreenPos = pParent->OutputToNormalizedScreenPixel( rSplitPos );
-    pViewData->GetView()->SnapSplitPos( aScreenPos );
-    Point aNew = pParent->NormalizedScreenToOutputPixel( aScreenPos );
-    if ( IsHorizontal() )
-        rSplitPos.X() = aNew.X();
-    else
-        rSplitPos.Y() = aNew.Y();
-}
-
 void ScTabSplitter::SetFixed(bool bSet)
 {
     bFixed = bSet;
commit b01bcbda617b9e53e1ba9b0d3e9808cc6930c6f0
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Feb 22 17:42:03 2015 +0900

    cell cursor - reduce the size, HiDPI support
    
    Change-Id: I24cd38f0f7e0f595815548a53824452d50ddd893

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 82ebf72..b65c209 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5797,19 +5797,39 @@ void ScGridWindow::UpdateCursorOverlay()
             long nSizeYPix;
             pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix );
 
-            if ( bLayoutRTL )
+            if (bLayoutRTL)
                 aScrPos.X() -= nSizeXPix - 2;       // move instead of mirroring
 
-            // Now, draw the cursor.
+            Rectangle aRect( aScrPos, Size( nSizeXPix - 1, nSizeYPix - 1) );
+
+            sal_Int32 nScale = GetDPIScaleFactor();
+
+            long aCursorWidth = 1 * nScale;
+
+            Rectangle aLeft = Rectangle(aRect);
+            aLeft.Top()    -= aCursorWidth;
+            aLeft.Bottom() += aCursorWidth;
+            aLeft.Right()   = aLeft.Left();
+            aLeft.Left()   -= aCursorWidth;
+
+            Rectangle aRight = Rectangle(aRect);
+            aRight.Top()    -= aCursorWidth;
+            aRight.Bottom() += aCursorWidth;
+            aRight.Left()    = aRight.Right();
+            aRight.Right()  += aCursorWidth;
+
+            Rectangle aTop = Rectangle(aRect);
+            aTop.Bottom()  = aTop.Top();
+            aTop.Top()    -= aCursorWidth;
 
-            aScrPos.X() -= 2;
-            aScrPos.Y() -= 2;
-            Rectangle aRect( aScrPos, Size( nSizeXPix + 3, nSizeYPix + 3 ) );
+            Rectangle aBottom = Rectangle(aRect);
+            aBottom.Top()     = aBottom.Bottom();
+            aBottom.Bottom() += aCursorWidth;
 
-            aPixelRects.push_back(Rectangle( aRect.Left(), aRect.Top(), aRect.Left()+2, aRect.Bottom() ));
-            aPixelRects.push_back(Rectangle( aRect.Right()-2, aRect.Top(), aRect.Right(), aRect.Bottom() ));
-            aPixelRects.push_back(Rectangle( aRect.Left()+3, aRect.Top(), aRect.Right()-3, aRect.Top()+2 ));
-            aPixelRects.push_back(Rectangle( aRect.Left()+3, aRect.Bottom()-2, aRect.Right()-3, aRect.Bottom() ));
+            aPixelRects.push_back(aLeft);
+            aPixelRects.push_back(aRight);
+            aPixelRects.push_back(aTop);
+            aPixelRects.push_back(aBottom);
         }
     }
 
commit 43bfb0e4a693962dae2320a1d7c8825880bcb769
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Feb 22 15:08:46 2015 +0900

    auto fill handle: HiDPI, increase hit area, adjust draw position
    
    Change-Id: I197ca370dad5cadcddd2472ed9f25d7b3acc504a

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index fcbed3d..82ebf72 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5948,18 +5948,30 @@ void ScGridWindow::UpdateAutoFillOverlay()
         ScDocument* pDoc = pViewData->GetDocument();
         bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
 
+        sal_Int32 nScale = GetDPIScaleFactor();
+        // Size should be even
+        Size aFillHandleSize = Size(6 * nScale, 6 * nScale);
+
         Point aFillPos = pViewData->GetScrPos( nX, nY, eWhich, true );
         long nSizeXPix;
         long nSizeYPix;
         pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix );
-        if ( bLayoutRTL )
-            aFillPos.X() -= nSizeXPix + 3;
+
+        if (bLayoutRTL)
+            aFillPos.X() -= nSizeXPix - 2 + (aFillHandleSize.Width() / 2);
         else
-            aFillPos.X() += nSizeXPix - 2;
+            aFillPos.X() += nSizeXPix - (aFillHandleSize.Width() / 2);
 
         aFillPos.Y() += nSizeYPix;
-        aFillPos.Y() -= 2;
-        mpAutoFillRect.reset(new Rectangle(aFillPos, Size(6, 6)));
+        aFillPos.Y() -= (aFillHandleSize.Height() / 2);
+
+        Rectangle aFillRect(aFillPos, aFillHandleSize);
+
+        // expand rect to increase hit area
+        mpAutoFillRect.reset(new Rectangle(aFillRect.Left()   - nScale,
+                                           aFillRect.Top()    - nScale,
+                                           aFillRect.Right()  + nScale,
+                                           aFillRect.Bottom() + nScale));
 
         // #i70788# get the OverlayManager safely
         rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager();
@@ -5972,7 +5984,7 @@ void ScGridWindow::UpdateAutoFillOverlay()
                 aHandleColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor;
             std::vector< basegfx::B2DRange > aRanges;
             const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
-            basegfx::B2DRange aRB(mpAutoFillRect->Left(), mpAutoFillRect->Top(), mpAutoFillRect->Right() + 1, mpAutoFillRect->Bottom() + 1);
+            basegfx::B2DRange aRB(aFillRect.Left(), aFillRect.Top(), aFillRect.Right(), aFillRect.Bottom());
 
             aRB.transform(aTransform);
             aRanges.push_back(aRB);
commit abc3163756f99196ccfb5e69ad5afe070e213c54
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Feb 22 14:00:33 2015 +0900

    fix selection overlay drawing in RTL (off by one px)
    
    Change-Id: I82a743ef3935baab82d9f9239bd589e55def8d76

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index eaaa620..fcbed3d 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5867,7 +5867,7 @@ void ScGridWindow::UpdateSelectionOverlay()
     std::vector<Rectangle> aPixelRects;
     GetSelectionRects( aPixelRects );
 
-    if ( aPixelRects.size() && pViewData->IsActive() )
+    if (!aPixelRects.empty() && pViewData->IsActive())
     {
         // #i70788# get the OverlayManager safely
         rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager();
@@ -5876,13 +5876,25 @@ void ScGridWindow::UpdateSelectionOverlay()
         {
             std::vector< basegfx::B2DRange > aRanges;
             const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+            ScDocument* pDoc = pViewData->GetDocument();
+            SCTAB nTab = pViewData->GetTabNo();
+            bool bLayoutRTL = pDoc->IsLayoutRTL( nTab );
 
             for(sal_uInt32 a(0); a < aPixelRects.size(); a++)
             {
                 const Rectangle aRA(aPixelRects[a]);
-                basegfx::B2DRange aRB(aRA.Left() - 1, aRA.Top() - 1, aRA.Right(), aRA.Bottom());
-                aRB.transform(aTransform);
-                aRanges.push_back(aRB);
+                if (bLayoutRTL)
+                {
+                    basegfx::B2DRange aRB(aRA.Left(), aRA.Top() - 1, aRA.Right() + 1, aRA.Bottom());
+                    aRB.transform(aTransform);
+                    aRanges.push_back(aRB);
+                }
+                else
+                {
+                    basegfx::B2DRange aRB(aRA.Left() - 1, aRA.Top() - 1, aRA.Right(), aRA.Bottom());
+                    aRB.transform(aTransform);
+                    aRanges.push_back(aRB);
+                }
             }
 
             // get the system's highlight color
commit 04767c132c1ca692c7e989b241eae40af33e43e8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon Feb 23 19:06:24 2015 +0900

    make calc splitter handle HiDPI aware
    
    Splitter is very small on a HiDPI screen, which also makes the
    mouse hit area small and thus hard to click. This change scales
    the width of the handle in relation to DPI scale factor.
    
    Change-Id: I5dacdafc97bf9cbeae7dcc888ba67d804ce62587

diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index efc7758..1f5f07c 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -332,10 +332,12 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner )
     if ( bMinimized )
         return;
 
-    long nSplitSizeX = SPLIT_HANDLE_SIZE;
+    sal_Int32 aScaleFactor = pFrameWin->GetDPIScaleFactor();
+
+    long nSplitSizeX = SPLIT_HANDLE_SIZE * aScaleFactor;
     if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX )
         nSplitSizeX = 1;
-    long nSplitSizeY = SPLIT_HANDLE_SIZE;
+    long nSplitSizeY = SPLIT_HANDLE_SIZE * aScaleFactor;
     if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX )
         nSplitSizeY = 1;
 


More information about the Libreoffice-commits mailing list