[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 2 07:45:35 UTC 2019
include/vcl/decoview.hxx | 6 +----
vcl/source/control/button.cxx | 50 ++++++++++++++++++------------------------
2 files changed, 24 insertions(+), 32 deletions(-)
New commits:
commit 6aaf6c4c5ad096ed11fc524ebe0540ba0a41c053
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Aug 1 21:28:17 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Aug 2 09:44:54 2019 +0200
DrawButtonFlags::NoText never set
Change-Id: I23531adc0798ec4a97538a8002ba0866535677a3
Reviewed-on: https://gerrit.libreoffice.org/76829
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/decoview.hxx b/include/vcl/decoview.hxx
index 51eb1b75afa0..5bcdcc1a208a 100644
--- a/include/vcl/decoview.hxx
+++ b/include/vcl/decoview.hxx
@@ -87,12 +87,11 @@ enum class DrawButtonFlags
Disabled = 0x0040,
Highlight = 0x0100,
Flat = 0x0200,
- NoLeftLightBorder = 0x1000,
- NoText = 0x2000
+ NoLeftLightBorder = 0x1000
};
namespace o3tl
{
- template<> struct typed_flags<DrawButtonFlags> : is_typed_flags<DrawButtonFlags, 0x337f> {};
+ template<> struct typed_flags<DrawButtonFlags> : is_typed_flags<DrawButtonFlags, 0x137f> {};
}
class VCL_DLLPUBLIC DecorationView
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index a46ab29fc08a..7240f7ce1b87 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -219,7 +219,7 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
{
OUString aText(GetText());
bool bDrawImage = HasImage();
- bool bDrawText = !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText);
+ bool bDrawText = !aText.isEmpty();
bool bHasSymbol = pSymbolRect != nullptr;
// No text and no image => nothing to do => return
@@ -839,23 +839,19 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice* pDev, DrawFlags nDrawFl
{
long nSeparatorX = 0;
tools::Rectangle aSymbolRect = aInRect;
- if (!(ImplGetButtonState() & DrawButtonFlags::NoText))
- {
- // calculate symbol size
- long nSymbolSize = pDev->GetTextHeight() / 2 + 1;
- nSeparatorX = aInRect.Right() - 2*nSymbolSize;
- aSize.AdjustWidth( -(2*nSymbolSize) );
+ // calculate symbol size
+ long nSymbolSize = pDev->GetTextHeight() / 2 + 1;
- // center symbol rectangle in the separated area
- aSymbolRect.AdjustRight( -(nSymbolSize/2) );
- aSymbolRect.SetLeft( aSymbolRect.Right() - nSymbolSize );
+ nSeparatorX = aInRect.Right() - 2*nSymbolSize;
+ aSize.AdjustWidth( -(2*nSymbolSize) );
- ImplDrawAlignedImage( pDev, aPos, aSize, nImageSep,
- nTextStyle, nullptr, true );
- }
- else
- ImplCalcSymbolRect( aSymbolRect );
+ // center symbol rectangle in the separated area
+ aSymbolRect.AdjustRight( -(nSymbolSize/2) );
+ aSymbolRect.SetLeft( aSymbolRect.Right() - nSymbolSize );
+
+ ImplDrawAlignedImage( pDev, aPos, aSize, nImageSep,
+ nTextStyle, nullptr, true );
long nDistance = (aSymbolRect.GetHeight() > 10) ? 2 : 1;
DecorationView aDecoView( pDev );
@@ -1626,7 +1622,7 @@ Size PushButton::CalcMinimumSize() const
long nSymbolSize = GetTextHeight() / 2 + 1;
aSize.AdjustWidth(2*nSymbolSize );
}
- if ( !PushButton::GetText().isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (!PushButton::GetText().isEmpty())
{
Size textSize = GetTextRect( tools::Rectangle( Point(), Size( 0x7fffffff, 0x7fffffff ) ),
PushButton::GetText(), ImplGetTextStyle( DrawFlags::NONE ) ).GetSize();
@@ -2015,8 +2011,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
// no image radio button
if ( !maImage )
{
- if ( ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) ) ||
- HasImage() )
+ if (!aText.isEmpty() || HasImage())
{
DrawTextFlags nTextStyle = Button::ImplGetTextStyle( nWinStyle, nDrawFlags );
@@ -2085,7 +2080,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
long nTextWidth = pDev->GetCtrlTextWidth( aText );
// calculate position and sizes
- if ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (!aText.isEmpty())
{
Size aTmpSize( (aImageSize.Width()+8), (aImageSize.Height()+8) );
if ( bTopImage )
@@ -2855,7 +2850,7 @@ Size RadioButton::CalcMinimumSize() const
}
OUString aText = GetText();
- if ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (!aText.isEmpty())
{
bool bTopImage = (GetStyle() & WB_TOP) != 0;
@@ -3032,8 +3027,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
pDev->Push( PushFlags::CLIPREGION | PushFlags::LINECOLOR );
pDev->IntersectClipRegion( tools::Rectangle( rPos, rSize ) );
- if ( ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) ) ||
- ( HasImage() ) )
+ if (!aText.isEmpty() || HasImage())
{
DrawTextFlags nTextStyle = Button::ImplGetTextStyle( nWinStyle, nDrawFlags );
@@ -3359,7 +3353,7 @@ void CheckBox::Resize()
void CheckBox::GetFocus()
{
- if ( GetText().isEmpty() || (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (GetText().isEmpty())
{
// increase button size to have space for focus rect
// checkboxes without text will draw focusrect around the check
@@ -3391,7 +3385,7 @@ void CheckBox::LoseFocus()
HideFocus();
Button::LoseFocus();
- if ( GetText().isEmpty() || (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (GetText().isEmpty())
{
// decrease button size again (see GetFocus())
// checkboxes without text will draw focusrect around the check
@@ -3672,7 +3666,7 @@ Size CheckBox::CalcMinimumSize( long nMaxWidth ) const
nMaxWidth -= aSize.Width();
OUString aText = GetText();
- if ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (!aText.isEmpty())
{
// subtract what will be added later
nMaxWidth-=2;
commit 40b18263e71921a5bb4f219b2098022a5bbbad19
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Aug 1 21:22:15 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Aug 2 09:44:40 2019 +0200
DrawButtonFlags::NoImage never set
Change-Id: I7ad7dbadad3bff1fe60b4aa9950bf1ec6a902835
Reviewed-on: https://gerrit.libreoffice.org/76828
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/decoview.hxx b/include/vcl/decoview.hxx
index 3a186b4cecf9..51eb1b75afa0 100644
--- a/include/vcl/decoview.hxx
+++ b/include/vcl/decoview.hxx
@@ -88,12 +88,11 @@ enum class DrawButtonFlags
Highlight = 0x0100,
Flat = 0x0200,
NoLeftLightBorder = 0x1000,
- NoText = 0x2000,
- NoImage = 0x4000,
+ NoText = 0x2000
};
namespace o3tl
{
- template<> struct typed_flags<DrawButtonFlags> : is_typed_flags<DrawButtonFlags, 0x737f> {};
+ template<> struct typed_flags<DrawButtonFlags> : is_typed_flags<DrawButtonFlags, 0x337f> {};
}
class VCL_DLLPUBLIC DecorationView
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 1c1b673770d3..a46ab29fc08a 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -218,7 +218,7 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
bool bAddImageSep)
{
OUString aText(GetText());
- bool bDrawImage = HasImage() && ! (ImplGetButtonState() & DrawButtonFlags::NoImage);
+ bool bDrawImage = HasImage();
bool bDrawText = !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText);
bool bHasSymbol = pSymbolRect != nullptr;
@@ -1618,7 +1618,7 @@ Size PushButton::CalcMinimumSize() const
else
aSize = Size( 26, 24 );
}
- else if ( Button::HasImage() && ! (ImplGetButtonState() & DrawButtonFlags::NoImage) )
+ else if ( Button::HasImage() )
aSize = GetModeImage().GetSizePixel();
if( mnDDStyle == PushButtonDropdownStyle::MenuButton ||
mnDDStyle == PushButtonDropdownStyle::SplitMenuButton )
@@ -2016,7 +2016,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
if ( !maImage )
{
if ( ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) ) ||
- ( HasImage() && ! (ImplGetButtonState() & DrawButtonFlags::NoImage) ) )
+ HasImage() )
{
DrawTextFlags nTextStyle = Button::ImplGetTextStyle( nWinStyle, nDrawFlags );
@@ -2847,7 +2847,7 @@ Size RadioButton::CalcMinimumSize() const
aSize.AdjustHeight(8);
}
- if (Button::HasImage() && !(ImplGetButtonState() & DrawButtonFlags::NoImage))
+ if (Button::HasImage())
{
Size aImgSize = GetModeImage().GetSizePixel();
aSize = Size(std::max(aImgSize.Width(), aSize.Width()),
@@ -3033,7 +3033,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
pDev->IntersectClipRegion( tools::Rectangle( rPos, rSize ) );
if ( ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) ) ||
- ( HasImage() && ! (ImplGetButtonState() & DrawButtonFlags::NoImage) ) )
+ ( HasImage() ) )
{
DrawTextFlags nTextStyle = Button::ImplGetTextStyle( nWinStyle, nDrawFlags );
More information about the Libreoffice-commits
mailing list