[Libreoffice-commits] core.git: cui/source cui/uiconfig

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 1 20:01:18 UTC 2021


 cui/source/dialogs/FontFeaturesDialog.cxx |   17 +++++++++++++++--
 cui/source/inc/FontFeaturesDialog.hxx     |    3 ++-
 cui/uiconfig/ui/fontfeaturesdialog.ui     |    1 +
 cui/uiconfig/ui/fontfragment.ui           |    2 +-
 4 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 6e09d59a503e98f97dea406bb3c2c703edf92d8e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Apr 1 16:56:08 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Apr 1 22:00:33 2021 +0200

    tdf#141333 use a vertical step increment of one row height
    
    for font feature scrolled window
    
    Change-Id: I000d53af7128377930644591a096c94366da281b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113465
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/FontFeaturesDialog.cxx b/cui/source/dialogs/FontFeaturesDialog.cxx
index fae448b6a283..04255cb13a6b 100644
--- a/cui/source/dialogs/FontFeaturesDialog.cxx
+++ b/cui/source/dialogs/FontFeaturesDialog.cxx
@@ -73,18 +73,26 @@ void FontFeaturesDialog::initialize()
         rFilteredFontFeatures.push_back(rFontFeature);
     }
 
-    fillGrid(rFilteredFontFeatures);
+    int nRowHeight = fillGrid(rFilteredFontFeatures);
 
     m_xContentWindow->set_size_request(
         -1, std::min(std::max(m_xContentWindow->get_preferred_size().Height(),
                               m_xContentGrid->get_preferred_size().Height()),
                      static_cast<tools::Long>(300L)));
 
+    if (nRowHeight)
+    {
+        // tdf#141333 use row height + the 6 px spacing of contentGrid
+        m_xContentWindow->vadjustment_set_step_increment(nRowHeight + 6);
+    }
+
     updateFontPreview();
 }
 
-void FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures)
+int FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures)
 {
+    int nRowHeight(0);
+
     vcl::font::FeatureParser aParser(m_sFontName);
     auto aExistingFeatures = aParser.getFeaturesMap();
 
@@ -140,8 +148,13 @@ void FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFe
             aCurrentItem.m_xCheck->show();
         }
 
+        nRowHeight
+            = std::max<int>(nRowHeight, aCurrentItem.m_xContainer->get_preferred_size().Height());
+
         i++;
     }
+
+    return nRowHeight;
 }
 
 void FontFeaturesDialog::updateFontPreview()
diff --git a/cui/source/inc/FontFeaturesDialog.hxx b/cui/source/inc/FontFeaturesDialog.hxx
index 6fd8b9de037e..337014bd8c0d 100644
--- a/cui/source/inc/FontFeaturesDialog.hxx
+++ b/cui/source/inc/FontFeaturesDialog.hxx
@@ -55,7 +55,8 @@ private:
     void initialize();
     OUString createFontNameWithFeatures();
 
-    void fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures);
+    // returns the max height of a row
+    int fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures);
 
     DECL_LINK(ComboBoxSelectedHdl, weld::ComboBox&, void);
     DECL_LINK(CheckBoxToggledHdl, weld::ToggleButton&, void);
diff --git a/cui/uiconfig/ui/fontfeaturesdialog.ui b/cui/uiconfig/ui/fontfeaturesdialog.ui
index fa36d66ff476..585d3760311a 100644
--- a/cui/uiconfig/ui/fontfeaturesdialog.ui
+++ b/cui/uiconfig/ui/fontfeaturesdialog.ui
@@ -96,6 +96,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="valign">start</property>
+                        <property name="row-homogeneous">True</property>
                         <property name="row_spacing">6</property>
                         <property name="column_spacing">12</property>
                         <property name="margin">6</property>
diff --git a/cui/uiconfig/ui/fontfragment.ui b/cui/uiconfig/ui/fontfragment.ui
index 140083b9687e..e66cd71b7ba6 100644
--- a/cui/uiconfig/ui/fontfragment.ui
+++ b/cui/uiconfig/ui/fontfragment.ui
@@ -7,7 +7,7 @@
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="no_show_all">True</property>
-    <property name="valign">start</property>
+    <property name="valign">center</property>
     <property name="hexpand">True</property>
     <property name="vexpand">True</property>
     <property name="column_spacing">6</property>


More information about the Libreoffice-commits mailing list