svx/source/tbxctrls/tbxcolorupdate.cxx | 27 +++++++++++++++++++++++---- vcl/source/window/toolbox.cxx | 3 +++ 2 files changed, 26 insertions(+), 4 deletions(-)
New commits: commit 9b1c534149878e31c62e49a60ed83e7ae0033d31 Author: Marco Cecchetti <marco.cecche...@collabora.com> AuthorDate: Tue Sep 24 16:37:46 2019 +0200 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Tue Sep 24 19:09:03 2019 +0200 tdf#126966: Use larger buttons for the colours in the sidebar on iOS - 2 This mostly reverts commit 918194c26ced8627d4f94840a4fb52ed70185446 that reverted "tdf#126966: Use larger buttons for the colours in the sidebar on iOS" So in the end Tor's patch was not so far from being the right solution. Just we need to avoid to triplicate the button size each time the update method is invoked. Change-Id: I9687546889bc20ef95a50aeafbc6f40e939d57a9 Reviewed-on: https://gerrit.libreoffice.org/79468 Reviewed-by: Tor Lillqvist <t...@collabora.com> Tested-by: Tor Lillqvist <t...@collabora.com> diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index 974834034de3..cebe10f670bb 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,19 @@ 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) + { + // usually the normal size is 16 + const long nIOSSize = 40; + if (aItemSize.getWidth() < nIOSSize) + { + aItemSize.setWidth(nIOSSize); + aItemSize.setHeight(nIOSSize); + } + } +#endif const bool bSizeChanged = (maBmpSize != aItemSize); const bool bDisplayModeChanged = (mbWasHiContrastMode != mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode()); Color aColor(rColor); @@ -92,9 +103,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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits