sw/inc/AnnotationWin.hxx | 2 + sw/source/uibase/docvw/AnnotationWin2.cxx | 49 +++++++++++++++++------------- 2 files changed, 31 insertions(+), 20 deletions(-)
New commits: commit 47ad7497f736b27c23667e0754cd686b78b60744 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Mar 10 17:02:46 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Mar 11 14:28:34 2021 +0100 tdf#140934 update annotation menubutton bg when comment color changes Change-Id: Ia4d10a8f19c039655dbe28c5f612061ce3755afa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112278 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index 15dc3e177ea3..f1ba8a499589 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -221,6 +221,8 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public InterimItemWindow SvxLanguageItem GetLanguage() const; + void SetMenuButtonColors(); + SwPostItMgr& mrMgr; SwView& mrView; diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index b3e361793b99..2c82afeb8b3f 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -441,6 +441,33 @@ static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFr sal_uInt8(aFront.GetBlue() * aTransparency / 255.0 + aBack.GetBlue() * (1 - aTransparency / 255.0))); } +void SwAnnotationWin::SetMenuButtonColors() +{ + if (!mxMenuButton) + return; + + mxMenuButton->set_background(mColorDark); + + const Fraction& rFraction = mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY(); + + ScopedVclPtrInstance<VirtualDevice> xVirDev; + Size aSize(tools::Long(METABUTTON_WIDTH * rFraction), + tools::Long(METABUTTON_HEIGHT * rFraction)); + tools::Rectangle aRect(Point(0, 0), aSize); + xVirDev->SetOutputSizePixel(aSize); + + Gradient aGradient(GradientStyle::Linear, + ColorFromAlphaColor(15, mColorAnchor, mColorDark), + ColorFromAlphaColor(80, mColorAnchor, mColorDark)); + xVirDev->DrawGradient(aRect, aGradient); + + DecorationView aDecoView(xVirDev.get()); + aDecoView.DrawSymbol(aRect, SymbolType::SPIN_DOWN, GetTextColor(), + DrawSymbolFlags::NONE); + mxMenuButton->set_image(xVirDev); + mxMenuButton->set_size_request(aSize.Width() + 4, aSize.Height()); +} + void SwAnnotationWin::Rescale() { // On Android, this method leads to invoke ImpEditEngine::UpdateViews @@ -468,25 +495,7 @@ void SwAnnotationWin::Rescale() mxMetadataDate->set_font(aFont); if (mxMetadataResolved) mxMetadataResolved->set_font(aFont); - if (mxMenuButton) - { - ScopedVclPtrInstance<VirtualDevice> xVirDev; - Size aSize(tools::Long(METABUTTON_WIDTH * rFraction), - tools::Long(METABUTTON_HEIGHT * rFraction)); - tools::Rectangle aRect(Point(0, 0), aSize); - xVirDev->SetOutputSizePixel(aSize); - - Gradient aGradient(GradientStyle::Linear, - ColorFromAlphaColor(15, mColorAnchor, mColorDark), - ColorFromAlphaColor(80, mColorAnchor, mColorDark)); - xVirDev->DrawGradient(aRect, aGradient); - - DecorationView aDecoView(xVirDev.get()); - aDecoView.DrawSymbol(aRect, SymbolType::SPIN_DOWN, GetTextColor(), - DrawSymbolFlags::NONE); - mxMenuButton->set_image(xVirDev); - mxMenuButton->set_size_request(aSize.Width() + 4, aSize.Height()); - } + SetMenuButtonColors(); if (mxVScrollbar) mxVScrollbar->set_scroll_thickness(GetPrefScrollbarWidth()); } @@ -835,7 +844,7 @@ void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorA return; m_xContainer->set_background(mColorDark); - mxMenuButton->set_background(mColorDark); + SetMenuButtonColors(); mxMetadataAuthor->set_font_color(aColorAnchor); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits