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

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 10 13:15:38 UTC 2020


 vcl/source/control/tabctrl.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit a3ccda320ff41e1bf624cc3b93029b3b24eed884
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon Jun 15 19:45:50 2020 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jul 10 15:15:14 2020 +0200

    tdf#133877 use optimal size for hamburger button
    
    This way it'll properly scale, instead of using the fixed 28 pixel
    dimension. This is a hack, which is used a few more times in VCL.
    Still this should not be needed, but done automatically.
    If there aren't any constraints, just return the optimal size!
    
    Change-Id: I8aa32645ea95cba28d0daf56f0be27c15153b6c9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96390
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit eff34e639055701b1299c07e6cdc0ce07cfc0936)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96411
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    (cherry picked from commit 1c73b219487b2aa60d888755cf4eca082e6b00c0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97464
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98503
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 7b90e03ba5e9..5e52bb0f3885 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -84,7 +84,6 @@ struct ImplTabCtrlData
 
 // for the Tab positions
 #define TAB_PAGERECT        0xFFFF
-#define HAMBURGER_DIM       28
 
 void TabControl::ImplInit( vcl::Window* pParent, WinBits nStyle )
 {
@@ -2218,9 +2217,9 @@ NotebookbarTabControlBase::NotebookbarTabControlBase(vcl::Window* pParent)
     , eLastContext(vcl::EnumContext::Context::Any)
 {
     m_pOpenMenu = VclPtr<PushButton>::Create( this , WB_CENTER | WB_VCENTER );
-    m_pOpenMenu->SetSizePixel(Size(HAMBURGER_DIM, HAMBURGER_DIM));
     m_pOpenMenu->SetClickHdl(LINK(this, NotebookbarTabControlBase, OpenMenu));
     m_pOpenMenu->SetModeImage(Image(StockImage::Yes, SV_RESID_BITMAP_NOTEBOOKBAR));
+    m_pOpenMenu->SetSizePixel(m_pOpenMenu->GetOptimalSize());
     m_pOpenMenu->Show();
 }
 
@@ -2327,7 +2326,8 @@ bool NotebookbarTabControlBase::ImplPlaceTabs( long nWidth )
     if (!m_pOpenMenu || m_pOpenMenu->isDisposed())
         return false;
 
-    long nMaxWidth = nWidth - HAMBURGER_DIM;
+    const long nHamburgerWidth = m_pOpenMenu->GetSizePixel().Width();
+    long nMaxWidth = nWidth - nHamburgerWidth;
     long nShortcutsWidth = m_pShortcuts != nullptr ? m_pShortcuts->GetSizePixel().getWidth() + 1 : 0;
     long nFullWidth = nShortcutsWidth;
 
@@ -2395,7 +2395,7 @@ bool NotebookbarTabControlBase::ImplPlaceTabs( long nWidth )
 
     long nPosY = (m_nHeaderHeight - m_pOpenMenu->GetSizePixel().getHeight()) / 2;
     // position the menu
-    m_pOpenMenu->SetPosPixel(Point(nWidth - HAMBURGER_DIM, nPosY));
+    m_pOpenMenu->SetPosPixel(Point(nWidth - nHamburgerWidth, nPosY));
 
     return true;
 }


More information about the Libreoffice-commits mailing list