starmath/inc/dialog.hxx    |    8 ++++++--
 starmath/source/dialog.cxx |    9 +++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit b183687274f12a21837f2d5d4e1280017e8e44ef
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Mar 29 13:51:50 2019 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Apr 2 09:58:10 2019 +0200

    tdf#124386 re-call SetScrollBarRange when aSymbolSet changes
    
    and do the work that depends on size happen at size-changed
    instead of first-draw
    
    Change-Id: Ia2605ba9bb875be9248a009a6f26f01cbbbd4632
    Reviewed-on: https://gerrit.libreoffice.org/69928
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit fdeada8c50c3e9126537ceafc649c85dc4be598c)
    Reviewed-on: https://gerrit.libreoffice.org/70050

diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 2e2300a9aa64..0de9a143b10d 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -260,6 +260,7 @@ class SmShowSymbolSet : public weld::CustomWidgetController
     virtual void Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect) override;
     virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
     virtual bool KeyInput(const KeyEvent& rKEvt) override;
+    virtual void Resize() override;
 
     DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
 
@@ -269,8 +270,11 @@ public:
     virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
     {
         CustomWidgetController::SetDrawingArea(pDrawingArea);
-        
pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 27,
-                                       pDrawingArea->get_text_height() * 9);
+        m_aOldSize = Size(pDrawingArea->get_approximate_digit_width() * 27,
+                          pDrawingArea->get_text_height() * 9);
+        pDrawingArea->set_size_request(m_aOldSize.Width(), 
m_aOldSize.Height());
+        SetOutputSizePixel(m_aOldSize);
+        calccols(pDrawingArea->get_ref_device());
     }
 
     void calccols(vcl::RenderContext& rRenderContext);
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 61f3edeaf885..bb312d075e5d 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -937,15 +937,19 @@ Point SmShowSymbolSet::OffsetPoint(const Point &rPoint) 
const
     return Point(rPoint.X() + nXOffset, rPoint.Y() + nYOffset);
 }
 
-void SmShowSymbolSet::Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle&)
+void SmShowSymbolSet::Resize()
 {
+    CustomWidgetController::Resize();
     Size aWinSize(GetOutputSizePixel());
     if (aWinSize != m_aOldSize)
     {
-        calccols(rRenderContext);
+        calccols(GetDrawingArea()->get_ref_device());
         m_aOldSize = aWinSize;
     }
+}
 
+void SmShowSymbolSet::Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle&)
+{
     Color aBackgroundColor;
     Color aTextColor;
     lclGetSettingColors(aBackgroundColor, aTextColor);
@@ -1083,6 +1087,7 @@ void SmShowSymbolSet::calccols(vcl::RenderContext& 
rRenderContext)
 void SmShowSymbolSet::SetSymbolSet(const SymbolPtrVec_t& rSymbolSet)
 {
     aSymbolSet = rSymbolSet;
+    SetScrollBarRange();
     Invalidate();
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to