[Libreoffice-commits] core.git: solenv/sanitizers sw/inc sw/source sw/uiconfig
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 19 14:56:14 UTC 2021
solenv/sanitizers/ui/modules/swriter.suppr | 1
sw/inc/AnnotationWin.hxx | 1
sw/source/uibase/docvw/AnnotationWin2.cxx | 41 +++++++++++++++++++++--------
sw/uiconfig/swriter/ui/annotation.ui | 23 +++++++++-------
4 files changed, 45 insertions(+), 21 deletions(-)
New commits:
commit d3765ec240eca85a72c6940a5e19bb82d65cad03
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 19 10:52:49 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Feb 19 15:55:33 2021 +0100
Related: tdf#140409 scale the menubutton like the other widgets
Change-Id: I6b42ef958dd1625cfef5e48e45c932aef9a5960f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111211
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/solenv/sanitizers/ui/modules/swriter.suppr b/solenv/sanitizers/ui/modules/swriter.suppr
index fff3bdcb39bd..ead94f59a1fd 100644
--- a/solenv/sanitizers/ui/modules/swriter.suppr
+++ b/solenv/sanitizers/ui/modules/swriter.suppr
@@ -1,6 +1,7 @@
sw/uiconfig/swriter/ui/abstractdialog.ui://GtkLabel[@id='label4'] orphan-label
sw/uiconfig/swriter/ui/addentrydialog.ui://GtkEntry[@id='entry'] no-labelled-by
sw/uiconfig/swriter/ui/annotation.ui://GtkDrawingArea[@id='editview'] no-labelled-by
+sw/uiconfig/swriter/ui/annotation.ui://GtkMenuButton[@id='menubutton'] button-no-label
sw/uiconfig/swriter/ui/asciifilterdialog.ui://GtkLabel[@id='label5'] orphan-label
sw/uiconfig/swriter/ui/authenticationsettingsdialog.ui://GtkLabel[@id='label1'] orphan-label
sw/uiconfig/swriter/ui/authenticationsettingsdialog.ui://GtkLabel[@id='label2'] orphan-label
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 706531ec4137..a930ca0af940 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -153,7 +153,6 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public InterimItemWindow
sal_Int32 GetMetaHeight() const;
sal_Int32 GetMinimumSizeWithMeta() const;
sal_Int32 GetMinimumSizeWithoutMeta() const;
- sal_Int32 GetMetaButtonAreaWidth() const;
int GetPrefScrollbarWidth() const;
sal_Int32 GetNumFields() const;
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index dc68377d2d7e..8d0546a6d972 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -51,7 +51,9 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
+#include <vcl/decoview.hxx>
#include <vcl/event.hxx>
+#include <vcl/gradient.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <vcl/ptrstyle.hxx>
@@ -98,7 +100,6 @@ namespace sw::annotation {
#define METABUTTON_WIDTH 16
#define METABUTTON_HEIGHT 18
-#define METABUTTON_AREA_WIDTH 30
#define POSTIT_META_FIELD_HEIGHT sal_Int32(15)
#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
@@ -433,6 +434,13 @@ void SwAnnotationWin::CheckMetaText()
SwPostItMgr::GetColorAnchor(aIndex));
}
+static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFront, const Color& aBack)
+{
+ return Color(sal_uInt8(aFront.GetRed() * aTransparency / 255.0 + aBack.GetRed() * (1 - aTransparency / 255.0)),
+ sal_uInt8(aFront.GetGreen() * aTransparency / 255.0 + aBack.GetGreen() * (1 - aTransparency / 255.0)),
+ sal_uInt8(aFront.GetBlue() * aTransparency / 255.0 + aBack.GetBlue() * (1 - aTransparency / 255.0)));
+}
+
void SwAnnotationWin::Rescale()
{
// On Android, this method leads to invoke ImpEditEngine::UpdateViews
@@ -460,9 +468,27 @@ 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());
+ }
if (mxVScrollbar)
mxVScrollbar->set_scroll_thickness(GetPrefScrollbarWidth());
-
}
void SwAnnotationWin::SetPosAndSize()
@@ -1160,20 +1186,15 @@ void SwAnnotationWin::ResetAttributes()
int SwAnnotationWin::GetPrefScrollbarWidth() const
{
- return mrView.GetWrtShell().GetViewOptions()->GetZoom() / 10;
-}
-
-sal_Int32 SwAnnotationWin::GetMetaButtonAreaWidth() const
-{
- const Fraction& f( GetMapMode().GetScaleX() );
- return tools::Long(METABUTTON_AREA_WIDTH * f);
+ const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
+ return tools::Long(Application::GetSettings().GetStyleSettings().GetScrollBarSize() * f);
}
sal_Int32 SwAnnotationWin::GetMetaHeight() const
{
const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
const int fields = GetNumFields();
- return tools::Long(fields*POSTIT_META_FIELD_HEIGHT*f);
+ return tools::Long(fields*POSTIT_META_FIELD_HEIGHT * f);
}
sal_Int32 SwAnnotationWin::GetNumFields() const
diff --git a/sw/uiconfig/swriter/ui/annotation.ui b/sw/uiconfig/swriter/ui/annotation.ui
index 753f373136af..c0d937d00245 100644
--- a/sw/uiconfig/swriter/ui/annotation.ui
+++ b/sw/uiconfig/swriter/ui/annotation.ui
@@ -2,6 +2,12 @@
<!-- Generated with glade 3.38.2 -->
<interface domain="sw">
<requires lib="gtk+" version="3.20"/>
+ <object class="GtkImage" id="image7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">sfx2/res/menu.png</property>
+ <property name="icon_size">2</property>
+ </object>
<object class="GtkMenu" id="menu">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -206,19 +212,16 @@
<child>
<object class="GtkMenuButton" id="menubutton">
<property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="focus-on-click">False</property>
- <property name="label" translatable="no"></property>
- <property name="receives-default">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="popup">menu</property>
+ <property name="image">image7</property>
+ <property name="always_show_image">True</property>
+ <property name="relief">none</property>
<property name="valign">start</property>
<property name="margin-end">10</property>
<property name="margin-top">5</property>
- <property name="relief">none</property>
- <property name="draw-indicator">True</property>
- <property name="popup">menu</property>
- <child>
- <placeholder/>
- </child>
+ <property name="use_popover">False</property>
<style>
<class name="small-button"/>
</style>
More information about the Libreoffice-commits
mailing list