[Libreoffice-commits] core.git: include/vcl svx/source svx/uiconfig vcl/source

Maxim Monastirsky momonasmon at gmail.com
Fri Mar 17 12:24:08 UTC 2017


 include/vcl/settings.hxx                 |    2 +-
 svx/source/tbxctrls/SvxColorValueSet.cxx |    7 ++-----
 svx/source/tbxctrls/tbcontrl.cxx         |   15 ++++++++-------
 svx/uiconfig/ui/colorwindow.ui           |    4 +---
 vcl/source/app/settings.cxx              |    2 +-
 5 files changed, 13 insertions(+), 17 deletions(-)

New commits:
commit d920613f6733fdc5931b972177788eb3fbaee6c9
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Fri Mar 17 02:25:39 2017 +0200

    tdf#106458 Color widget should have same number of rows
    
    ... across different platforms/themes, so the standard
    palette will always fit without a scrollbar. For this,
    we must not hardcode some arbitrary fixed size, but
    calculate the size based on the number of rows of the
    standard palette.
    
    Change-Id: Ica1d615b43b350aece6b2c29a73337439dd05ac6

diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index ef1835929fbd..8dcaa4ceacfc 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -590,7 +590,7 @@ public:
     sal_uInt16                      GetColorValueSetColumnCount() const;
 
     // maximum row/line count for the ColorValueSet control. If more lines would be needed, a scrollbar will
-    // be used. Default is 40.
+    // be used.
     sal_uInt16                      GetColorValueSetMaximumRowCount() const;
 
     const Size&                     GetListBoxPreviewDefaultPixelSize() const;
diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx
index 65955445e602..bef5006d07d6 100644
--- a/svx/source/tbxctrls/SvxColorValueSet.cxx
+++ b/svx/source/tbxctrls/SvxColorValueSet.cxx
@@ -122,10 +122,7 @@ Size SvxColorValueSet::layoutAllVisible(sal_uInt32 nEntryCount)
 
 void SvxColorValueSet::Resize()
 {
-    vcl::Window *pParent = GetParent();
-    //don't do this for the drop down color palettes
-    if (pParent && pParent->GetType() != WindowType::FLOATINGWINDOW)
-        layoutToGivenHeight(GetOutputSizePixel().Height(), GetItemCount());
+    layoutToGivenHeight(GetSizePixel().Height(), GetItemCount());
     ValueSet::Resize();
 }
 
@@ -136,7 +133,7 @@ Size SvxColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntry
         nEntryCount++;
     }
 
-    const Size aItemSize(getEntryEdgeLength(), getEntryEdgeLength());
+    const Size aItemSize(getEntryEdgeLength() - 2, getEntryEdgeLength() - 2);
     const WinBits aWinBits(GetStyle() & ~WB_VSCROLL);
 
     // get size with all fields disabled
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index aeab85cdb3c8..2a9afe6474f3 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1324,10 +1324,9 @@ SvxColorWindow::SvxColorWindow(const OUString&            rCommand,
     }
     OUString aPaletteName( officecfg::Office::Common::UserColors::PaletteName::get() );
     mpPaletteListBox->SelectEntry( aPaletteName );
-    if (mpPaletteListBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND)
-    {
-        SelectPaletteHdl( *mpPaletteListBox );
-    }
+    const sal_Int32 nSelectedEntry(mpPaletteListBox->GetSelectEntryPos());
+    if (nSelectedEntry != LISTBOX_ENTRY_NOTFOUND)
+        mrPaletteManager.SetPalette(nSelectedEntry);
 
     mpButtonAutoColor->SetClickHdl( LINK( this, SvxColorWindow, AutoColorClickHdl ) );
     mpButtonNoneColor->SetClickHdl( LINK( this, SvxColorWindow, AutoColorClickHdl ) );
@@ -1339,11 +1338,13 @@ SvxColorWindow::SvxColorWindow(const OUString&            rCommand,
     mpColorSet->SetHelpId( HID_POPUP_COLOR_CTRL );
 
     mrPaletteManager.ReloadColorSet(*mpColorSet);
-    mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount());
+    const sal_uInt32 nMaxItems(mpColorSet->getMaxRowCount() * mpColorSet->getColumnCount());
+    Size aSize = mpColorSet->layoutAllVisible(nMaxItems);
+    mpColorSet->set_height_request(aSize.Height());
+    mpColorSet->set_width_request(aSize.Width());
 
     mrPaletteManager.ReloadRecentColorSet(*mpRecentColorSet);
-    mpRecentColorSet->SetLineCount( 1 );
-    Size aSize = mpRecentColorSet->layoutAllVisible(mrPaletteManager.GetRecentColorCount());
+    aSize = mpRecentColorSet->layoutAllVisible(mrPaletteManager.GetRecentColorCount());
     mpRecentColorSet->set_height_request(aSize.Height());
     mpRecentColorSet->set_width_request(aSize.Width());
 
diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui
index 06d41994e78d..427fe869a539 100644
--- a/svx/uiconfig/ui/colorwindow.ui
+++ b/svx/uiconfig/ui/colorwindow.ui
@@ -103,14 +103,12 @@
         </child>
         <child>
           <object class="svxcorelo-SvxColorValueSet" id="colorset">
-            <property name="width_request">200</property>
-            <property name="height_request">150</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
           </object>
           <packing>
-            <property name="expand">True</property>
+            <property name="expand">False</property>
             <property name="fill">True</property>
             <property name="position">3</property>
           </packing>
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index e500d50bfa8a..456aca3e109e 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -550,7 +550,7 @@ ImplStyleData::ImplStyleData() :
     maEdgeBlendingBottomRightColor = RGB_COLORDATA(0x40, 0x40, 0x40);
     mnListBoxMaximumLineCount = 25;
     mnColorValueSetColumnCount = 12;
-    mnColorValueSetMaximumRowCount = 20;
+    mnColorValueSetMaximumRowCount = 8;
     maListBoxPreviewDefaultLogicSize = Size(15, 7);
     maListBoxPreviewDefaultPixelSize = Size(0, 0); // on-demand calculated in GetListBoxPreviewDefaultPixelSize()
     mnListBoxPreviewDefaultLineWidth = 1;


More information about the Libreoffice-commits mailing list