[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - svx/source vcl/source

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 30 21:18:58 UTC 2019


 svx/source/tbxctrls/tbxcolorupdate.cxx |   22 ++++++++++++++++++----
 vcl/source/window/toolbox.cxx          |    3 +++
 2 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit 57255d4bc47dcabdcc0734d564059326910c5609
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Fri Aug 30 17:24:08 2019 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Aug 30 23:18:12 2019 +0200

    tdf#126966: Use larger buttons for the colours in the sidebar on iOS
    
    For iOS, increase both the size of the ToolboxButtonColorUpdater
    controls that aren't already requested to be "wide", whatever that
    means. Make sure to center the artwork for the button in the now
    enlarged area.
    
    For iOS, also increase the width of the dropdown arrows of ToolBox
    controls in general.
    
    Change-Id: I1bd2354925a5e084a9894470dc6e0045b353c90a
    Reviewed-on: https://gerrit.libreoffice.org/78303
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>

diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index 974834034de3..6e96e9b03edd 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include <svx/tbxcolorupdate.hxx>
 #include <svx/svxids.hrc>
 #include <svx/xdef.hxx>
@@ -71,7 +70,14 @@ namespace svx
     {
         Image aImage(mpTbx->GetItemImage(mnBtnId));
         Size aItemSize(mbWideButton ? mpTbx->GetItemContentSize(mnBtnId) : aImage.GetSizePixel());
-
+#ifdef IOS // tdf#126966
+        // Oddly enough, it is in the "not wide button" case that we want the larger ones, hmm.
+        if (!mbWideButton)
+        {
+            aItemSize.setWidth(aItemSize.getWidth() * 3);
+            aItemSize.setHeight(aItemSize.getHeight() * 3);
+        }
+#endif
         const bool bSizeChanged = (maBmpSize != aItemSize);
         const bool bDisplayModeChanged = (mbWasHiContrastMode != mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode());
         Color aColor(rColor);
@@ -92,9 +98,17 @@ namespace svx
         long nWidth = std::min(aItemSize.Width(), aSource.GetSizePixel().Width());
         long nHeight = std::min(aItemSize.Height(), aSource.GetSizePixel().Height());
 
-        tools::Rectangle aRect(Point(0, 0), Size(nWidth, nHeight));
+        // Be sure to center the image if necessary.
+        Point aDestination(0, 0);
+        if (aItemSize.getWidth() > aSource.GetSizePixel().getWidth())
+            aDestination.Move((aItemSize.getWidth() - aSource.GetSizePixel().getWidth()) / 2, 0);
+        if (aItemSize.getHeight() > aSource.GetSizePixel().getHeight())
+            aDestination.Move(0, (aItemSize.getHeight() - aSource.GetSizePixel().getHeight()) / 2);
+
+        tools::Rectangle aRectDestination(aDestination, Size(nWidth, nHeight));
+        tools::Rectangle aRectSource(Point(0, 0), Size(nWidth, nHeight));
 
-        aBmpEx.CopyPixel( aRect, aRect, &aSource );
+        aBmpEx.CopyPixel( aRectDestination, aRectSource, &aSource );
 
         Bitmap              aBmp( aBmpEx.GetBitmap() );
         BitmapWriteAccess*  pBmpAcc = aBmp.IsEmpty() ? nullptr : aBmp.AcquireWriteAccess();
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index bbc4ddf7c9a1..dda813ae3d90 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1427,6 +1427,9 @@ bool ToolBox::ImplCalcItem()
     long            nMinWidth   = 6;
     long            nMinHeight  = 6;
     long            nDropDownArrowWidth = TB_DROPDOWNARROWWIDTH;
+#ifdef IOS
+    nDropDownArrowWidth *= 3;
+#endif
 
     // set defaults if image or text is needed but empty
     nDefWidth  = GetDefaultImageSize().Width();


More information about the Libreoffice-commits mailing list