summaryrefslogtreecommitdiff
path: root/vcl/source/edit
diff options
context:
space:
mode:
authorJan-Marek Glogowski <jan-marek.glogowski@extern.cib.de>2019-11-26 14:39:30 +0000
committerJan-Marek Glogowski <glogow@fbihome.de>2019-11-26 20:51:04 +0100
commitb1e73fd49661e07e6085310f3f6ecc6ade2a3762 (patch)
treec3dd97710969139173bc05b98bef2770368bf85b /vcl/source/edit
parent11395405d08ecb44a555fd26d0e16993cb5e13f6 (diff)
tdf#127403 Revert "VCL keep / return the original set TextEngine font"
This reverts commit cc223fa12a61ba0e580b884386a7f5d7efd0541f. All the other attenps to fix this seem to cause timeouts in the Jenkins clang_dbgutil build. I don't have one around and no time to investigate further, so let's see, if the revert passes. Change-Id: Ib915185eaf79073523351705baf28df3c62906f1 Reviewed-on: https://gerrit.libreoffice.org/83654 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/source/edit')
-rw-r--r--vcl/source/edit/texteng.cxx7
-rw-r--r--vcl/source/edit/vclmedit.cxx74
2 files changed, 56 insertions, 25 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 8f1b27cfa940..397a1de8a23a 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -167,9 +167,8 @@ void TextEngine::SetActiveView( TextView* pTextView )
void TextEngine::SetFont( const vcl::Font& rFont )
{
- if (rFont == maOrigFont)
+ if ( rFont == maFont )
return;
- maOrigFont = rFont;
maFont = rFont;
// #i40221# As the font's color now defaults to transparent (since i35764)
@@ -204,9 +203,9 @@ void TextEngine::SetFont( const vcl::Font& rFont )
for ( auto nView = mpViews->size(); nView; )
{
TextView* pView = (*mpViews)[ --nView ];
- pView->GetWindow()->SetInputContext(InputContext(maFont, !pView->IsReadOnly()
- ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE));
+ pView->GetWindow()->SetInputContext( InputContext( GetFont(), !pView->IsReadOnly() ? InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) );
}
+
}
void TextEngine::SetMaxTextLen( sal_Int32 nLen )
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index cc2b52e658b7..0225f79d487e 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -914,8 +914,36 @@ WinBits VclMultiLineEdit::ImplInitStyle( WinBits nStyle )
return nStyle;
}
-void VclMultiLineEdit::ApplyBackgroundSettings(vcl::RenderContext& rRenderContext, const StyleSettings& rStyleSettings)
+void VclMultiLineEdit::ApplySettings(vcl::RenderContext& rRenderContext)
{
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+
+ // The Font has to be adjusted, as the TextEngine does not take care of
+ // TextColor/Background
+
+ Color aTextColor = rStyleSettings.GetFieldTextColor();
+ if (IsControlForeground())
+ aTextColor = GetControlForeground();
+
+ if (!IsEnabled())
+ aTextColor = rStyleSettings.GetDisableColor();
+
+ vcl::Font aFont = rStyleSettings.GetFieldFont();
+ aFont.SetTransparent(IsPaintTransparent());
+ ApplyControlFont(rRenderContext, aFont);
+
+ vcl::Font theFont = rRenderContext.GetFont();
+ theFont.SetColor(aTextColor);
+ if (IsPaintTransparent())
+ theFont.SetFillColor(COL_TRANSPARENT);
+ else
+ theFont.SetFillColor(IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor());
+
+ pImpVclMEdit->GetTextWindow()->SetFont(theFont);
+ // FIXME: next call causes infinite invalidation loop, rethink how to properly fix this situation
+ // pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont(theFont);
+ pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor);
+
if (IsPaintTransparent())
{
pImpVclMEdit->GetTextWindow()->SetPaintTransparent(true);
@@ -935,8 +963,10 @@ void VclMultiLineEdit::ApplyBackgroundSettings(vcl::RenderContext& rRenderContex
}
}
-void VclMultiLineEdit::ApplyFontSettings(vcl::RenderContext& rRenderContext, const StyleSettings& rStyleSettings)
+void VclMultiLineEdit::ImplInitSettings(bool bBackground)
{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
// The Font has to be adjusted, as the TextEngine does not take care of
// TextColor/Background
@@ -948,36 +978,38 @@ void VclMultiLineEdit::ApplyFontSettings(vcl::RenderContext& rRenderContext, con
vcl::Font aFont = rStyleSettings.GetFieldFont();
aFont.SetTransparent(IsPaintTransparent());
- ApplyControlFont(rRenderContext, aFont);
+ ApplyControlFont(*this, aFont);
- vcl::Font TheFont = rRenderContext.GetFont();
+ vcl::Font TheFont = GetFont();
TheFont.SetColor(aTextColor);
if (IsPaintTransparent())
TheFont.SetFillColor(COL_TRANSPARENT);
else
TheFont.SetFillColor(IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor());
-
pImpVclMEdit->GetTextWindow()->SetFont(TheFont);
pImpVclMEdit->GetTextWindow()->GetTextEngine()->SetFont(TheFont);
pImpVclMEdit->GetTextWindow()->SetTextColor(aTextColor);
-}
-
-void VclMultiLineEdit::ApplySettings(vcl::RenderContext& rRenderContext)
-{
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
-
- ApplyFontSettings(rRenderContext, rStyleSettings);
- ApplyBackgroundSettings(rRenderContext, rStyleSettings);
-}
-
-void VclMultiLineEdit::ImplInitSettings(bool bBackground)
-{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- ApplyFontSettings(*this, rStyleSettings);
if (bBackground)
- ApplyBackgroundSettings(*this, rStyleSettings);
+ {
+ if (IsPaintTransparent())
+ {
+ pImpVclMEdit->GetTextWindow()->SetPaintTransparent(true);
+ pImpVclMEdit->GetTextWindow()->SetBackground();
+ pImpVclMEdit->GetTextWindow()->SetControlBackground();
+ SetBackground();
+ SetControlBackground();
+ }
+ else
+ {
+ if (IsControlBackground())
+ pImpVclMEdit->GetTextWindow()->SetBackground(GetControlBackground());
+ else
+ pImpVclMEdit->GetTextWindow()->SetBackground(rStyleSettings.GetFieldColor());
+ // also adjust for VclMultiLineEdit as the TextComponent might hide Scrollbars
+ SetBackground(pImpVclMEdit->GetTextWindow()->GetBackground());
+ }
+ }
}
void VclMultiLineEdit::Modify()