framework/source/fwe/classes/addonsoptions.cxx |    2 +-
 include/vcl/toolbox.hxx                        |    2 +-
 vcl/source/window/toolbox.cxx                  |    5 ++---
 vcl/source/window/toolbox2.cxx                 |   24 ++++++++++++++++--------
 4 files changed, 20 insertions(+), 13 deletions(-)

New commits:
commit 99fd3b2a2759864caf519dfd89173e301b74c24e
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
Date:   Fri Dec 9 15:35:50 2016 +0100

    vcl: set toolbox size correctly when using 32px icons
    
    Change-Id: Ifacff75f80bc8401ccff2a4d4dc90e56e3b4aa84
    Reviewed-on: https://gerrit.libreoffice.org/31801
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/framework/source/fwe/classes/addonsoptions.cxx 
b/framework/source/fwe/classes/addonsoptions.cxx
index c3013e4..fc11b4e 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -475,7 +475,7 @@ bool AddonsOptions_Impl::GetMergeToolbarInstructions(
 
 static Image ScaleImage( const Image &rImage, bool bBig )
 {
-    Size aSize = ToolBox::GetDefaultImageSize(bBig);
+    Size aSize = ToolBox::GetDefaultImageSize(bBig ? ToolBoxButtonSize::Large 
: ToolBoxButtonSize::Small);
     BitmapEx aScaleBmp(rImage.GetBitmapEx());
     SAL_INFO("fwk", "Addons: expensive scale image from "
              << aScaleBmp.GetSizePixel() << " to " << aSize);
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 03319ba..f2881b8 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -502,7 +502,7 @@ public:
     // if an index is found the corresponding item id is filled in (else 0)
     long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const;
 
-    static Size         GetDefaultImageSize(bool bLarge);
+    static Size         GetDefaultImageSize(ToolBoxButtonSize 
eToolBoxButtonSize);
     Size                GetDefaultImageSize() const;
     void                ChangeHighlight( sal_uInt16 nPos );
 
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 6ad9c21..5095ef2 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1671,9 +1671,8 @@ bool ToolBox::ImplCalcItem()
     long            nDropDownArrowWidth = TB_DROPDOWNARROWWIDTH;
 
     // set defaults if image or text is needed but empty
-    float fDPIScaleFactor = GetDPIScaleFactor();
-    nDefWidth  = GetDefaultImageSize().Width()  * fDPIScaleFactor;
-    nDefHeight = GetDefaultImageSize().Height() * fDPIScaleFactor;
+    nDefWidth  = GetDefaultImageSize().Width();
+    nDefHeight = GetDefaultImageSize().Height();
 
     mnWinHeight = 0;
     // determine minimum size necessary in NWF
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 38d8dd7..73af112 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -633,20 +633,28 @@ ToolBoxButtonSize ToolBox::GetToolboxButtonSize() const
     return mpData->meButtonSize;
 }
 
-/*static*/ Size ToolBox::GetDefaultImageSize(bool bLarge)
+/*static*/ Size ToolBox::GetDefaultImageSize(ToolBoxButtonSize 
eToolBoxButtonSize)
 {
-    const long TB_SMALLIMAGESIZE = 16;
-    if (!bLarge) {
-        return Size(TB_SMALLIMAGESIZE, TB_SMALLIMAGESIZE);
-    }
+    float fScaleFactor = Application::GetDefaultDevice()->GetDPIScaleFactor();
+
+    Size aUnscaledSize = Size(16, 16);
 
-    OUString iconTheme = 
Application::GetSettings().GetStyleSettings().DetermineIconTheme();
-    return vcl::IconThemeInfo::SizeByThemeName(iconTheme);
+    if (eToolBoxButtonSize == ToolBoxButtonSize::Large)
+    {
+        OUString iconTheme = 
Application::GetSettings().GetStyleSettings().DetermineIconTheme();
+        aUnscaledSize = vcl::IconThemeInfo::SizeByThemeName(iconTheme);
+    }
+    else if (eToolBoxButtonSize == ToolBoxButtonSize::Size32)
+    {
+        aUnscaledSize = Size(32, 32);
+    }
+    return Size(aUnscaledSize.Width()  * fScaleFactor,
+                aUnscaledSize.Height() * fScaleFactor);
 }
 
 Size ToolBox::GetDefaultImageSize() const
 {
-    return GetDefaultImageSize( GetToolboxButtonSize() == 
ToolBoxButtonSize::Large );
+    return GetDefaultImageSize(GetToolboxButtonSize());
 }
 
 void ToolBox::SetAlign( WindowAlign eNewAlign )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to