[Libreoffice-commits] core.git: 3 commits - framework/source include/vcl svx/source sw/source vcl/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Fri Dec 26 03:42:50 PST 2014
framework/source/uielement/statusbarmanager.cxx | 1 +
include/vcl/status.hxx | 3 +++
svx/source/stbctrls/zoomsliderctrl.cxx | 13 +++++++------
sw/source/uibase/utlui/viewlayoutctrl.cxx | 19 +++++++++----------
vcl/source/window/status.cxx | 10 ++++++++++
5 files changed, 30 insertions(+), 16 deletions(-)
New commits:
commit ac5cec21167f8addb7fe4973bf7fdf0f503d6259
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Dec 26 20:41:29 2014 +0900
Cleanup zoomsliderctrl & viewlayoutctrl
Change-Id: Ie5f135e8457ed75146328a388f3b70273bf54ed2
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index 8ea241b..dcb0c55 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -152,8 +152,8 @@ long SvxZoomSliderControl::Zoom2Offset( sal_uInt16 nCurrentZoom ) const
return nRet;
}
-SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& _rStb ) :
- SfxStatusBarControl( _nSlotId, _nId, _rStb ),
+SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& rStatusBar ) :
+ SfxStatusBarControl( _nSlotId, _nId, rStatusBar ),
mpImpl( new SvxZoomSliderControl_Impl )
{
mpImpl->maSliderButton = Image( SVX_RES( RID_SVXBMP_SLIDERBUTTON ) );
@@ -161,16 +161,17 @@ SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nI
mpImpl->maDecreaseButton = Image( SVX_RES( RID_SVXBMP_SLIDERDECREASE ) );
//#ifndef MACOSX
- if ( _rStb.GetDPIScaleFactor() > 1)
+ sal_Int32 nScaleFactor = rStatusBar.GetDPIScaleFactor();
+ if (nScaleFactor != 1)
{
Image arr[3] = {mpImpl->maSliderButton, mpImpl->maIncreaseButton, mpImpl->maDecreaseButton};
for (int i = 0; i < 3; i++)
{
- BitmapEx b = arr[i].GetBitmapEx();
+ BitmapEx aBitmap = arr[i].GetBitmapEx();
//Use Lanczos scaling for the slider button because it does a better job with circles
- b.Scale(_rStb.GetDPIScaleFactor(), _rStb.GetDPIScaleFactor(), i == 0 ? BMP_SCALE_LANCZOS : BMP_SCALE_FAST);
- arr[i] = Image(b);
+ aBitmap.Scale(nScaleFactor, nScaleFactor, i == 0 ? BMP_SCALE_LANCZOS : BMP_SCALE_FAST);
+ arr[i] = Image(aBitmap);
}
mpImpl->maSliderButton = arr[0];
mpImpl->maIncreaseButton = arr[1];
diff --git a/sw/source/uibase/utlui/viewlayoutctrl.cxx b/sw/source/uibase/utlui/viewlayoutctrl.cxx
index bf1f3a2..aa45d37 100644
--- a/sw/source/uibase/utlui/viewlayoutctrl.cxx
+++ b/sw/source/uibase/utlui/viewlayoutctrl.cxx
@@ -39,8 +39,8 @@ struct SwViewLayoutControl::SwViewLayoutControl_Impl
Image maImageBookMode_Active;
};
-SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& rStb ) :
- SfxStatusBarControl( _nSlotId, _nId, rStb ),
+SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& rStatusBar ) :
+ SfxStatusBarControl( _nSlotId, _nId, rStatusBar ),
mpImpl( new SwViewLayoutControl_Impl )
{
mpImpl->mnState = 0;
@@ -52,7 +52,8 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId,
mpImpl->maImageBookMode = Image( SW_RES(IMG_VIEWLAYOUT_BOOKMODE) );
mpImpl->maImageBookMode_Active = Image( SW_RES(IMG_VIEWLAYOUT_BOOKMODE_ACTIVE) );
- if ( rStb.GetDPIScaleFactor() > 1)
+ sal_Int32 nScaleFactor = rStatusBar.GetDPIScaleFactor();
+ if (nScaleFactor != 1)
{
Image arr[6] = {mpImpl->maImageSingleColumn, mpImpl->maImageSingleColumn_Active,
mpImpl->maImageAutomatic, mpImpl->maImageAutomatic_Active,
@@ -60,9 +61,9 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId,
for (int i = 0; i < 6; i++)
{
- BitmapEx b = arr[i].GetBitmapEx();
- b.Scale(rStb.GetDPIScaleFactor(), rStb.GetDPIScaleFactor(), BMP_SCALE_FAST);
- arr[i] = Image(b);
+ BitmapEx aBitmap = arr[i].GetBitmapEx();
+ aBitmap.Scale(nScaleFactor, nScaleFactor, BMP_SCALE_FAST);
+ arr[i] = Image(aBitmap);
}
mpImpl->maImageSingleColumn = arr[0];
@@ -74,7 +75,6 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId,
mpImpl->maImageBookMode = arr[4];
mpImpl->maImageBookMode_Active = arr[5];
}
-
}
SwViewLayoutControl::~SwViewLayoutControl()
@@ -124,8 +124,8 @@ void SwViewLayoutControl::Paint( const UserDrawEvent& rUsrEvt )
mpImpl->maImageAutomatic.GetSizePixel().Width() +
mpImpl->maImageBookMode.GetSizePixel().Width();
- const long nXOffset = (aRect.GetWidth() - nImageWidthSum)/2;
- const long nYOffset = (aControlRect.GetHeight() - mpImpl->maImageSingleColumn.GetSizePixel().Height())/2;
+ const long nXOffset = (aRect.GetWidth() - nImageWidthSum) / 2;
+ const long nYOffset = (aControlRect.GetHeight() - mpImpl->maImageSingleColumn.GetSizePixel().Height()) / 2;
aRect.Left() = aRect.Left() + nXOffset;
aRect.Top() = aRect.Top() + nYOffset;
commit b99aeb247d86be93947572adf7abc19a42ee6caf
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Dec 26 20:36:51 2014 +0900
HiDPI: ViewLayout statusbar - scale icons by both dimensions
Change-Id: Ibd8417e0f3daf17d94b5c13e4efcab20568e2153
diff --git a/sw/source/uibase/utlui/viewlayoutctrl.cxx b/sw/source/uibase/utlui/viewlayoutctrl.cxx
index b3204ee..bf1f3a2 100644
--- a/sw/source/uibase/utlui/viewlayoutctrl.cxx
+++ b/sw/source/uibase/utlui/viewlayoutctrl.cxx
@@ -61,8 +61,7 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId,
for (int i = 0; i < 6; i++)
{
BitmapEx b = arr[i].GetBitmapEx();
- //Don't scale width, no space.
- b.Scale(1.0, rStb.GetDPIScaleFactor(), BMP_SCALE_FAST);
+ b.Scale(rStb.GetDPIScaleFactor(), rStb.GetDPIScaleFactor(), BMP_SCALE_FAST);
arr[i] = Image(b);
}
commit 8a009858aa25825e26eb9f04ea1d3620445e6709
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Dec 26 20:33:34 2014 +0900
Adjust the statusbar item widths according to HiDPI scaling factor
Change-Id: Id697b3b799c7437d937de6534edf88083e5c4dfd
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 8c166e4..23a6306 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -147,6 +147,7 @@ StatusBarManager::StatusBarManager(
m_xStatusbarControllerFactory = frame::theStatusbarControllerFactory::get(
::comphelper::getProcessComponentContext());
+ m_pStatusBar->AdjustItemWidthsForHiDPI(true);
m_pStatusBar->SetClickHdl( LINK( this, StatusBarManager, Click ) );
m_pStatusBar->SetDoubleClickHdl( LINK( this, StatusBarManager, DoubleClick ) );
}
diff --git a/include/vcl/status.hxx b/include/vcl/status.hxx
index 0f74411..b6433ef 100644
--- a/include/vcl/status.hxx
+++ b/include/vcl/status.hxx
@@ -92,6 +92,7 @@ private:
bool mbFormat;
bool mbProgressMode;
bool mbInUserDraw;
+ bool mbAdjustHiDPI;
Link maClickHdl;
Link maDoubleClickHdl;
@@ -114,6 +115,8 @@ public:
WinBits nWinStyle = WB_BORDER | WB_RIGHT );
virtual ~StatusBar();
+ void AdjustItemWidthsForHiDPI(bool bAdjustHiDPI);
+
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Move() SAL_OVERRIDE;
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 8583e5f..2b74883 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -129,6 +129,7 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle )
mbVisibleItems = true;
mbProgressMode = false;
mbInUserDraw = false;
+ mbAdjustHiDPI = false;
mnItemsWidth = STATUSBAR_OFFSET_X;
mnDX = 0;
mnDY = 0;
@@ -161,6 +162,11 @@ StatusBar::~StatusBar()
delete mpImplData;
}
+void StatusBar::AdjustItemWidthsForHiDPI(bool bAdjustHiDPI)
+{
+ mbAdjustHiDPI = bAdjustHiDPI;
+}
+
void StatusBar::ImplInitSettings( bool bFont,
bool bForeground, bool bBackground )
{
@@ -899,6 +905,10 @@ void StatusBar::InsertItem( sal_uInt16 nItemId, sal_uLong nWidth,
nBits |= SIB_CENTER;
// create item
+ if (mbAdjustHiDPI && GetDPIScaleFactor() != 1)
+ {
+ nWidth *= GetDPIScaleFactor();
+ }
long nFudge = GetTextHeight()/4;
ImplStatusItem* pItem = new ImplStatusItem;
pItem->mnId = nItemId;
More information about the Libreoffice-commits
mailing list