[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - 2 commits - svx/source vcl/source

Norbert Thiebaud nthiebaud at gmail.com
Wed Mar 12 11:05:31 PDT 2014


 svx/source/tbxctrls/tbunocontroller.cxx |   22 +++++++++++++++++-----
 vcl/source/window/window.cxx            |   10 +++++++++-
 2 files changed, 26 insertions(+), 6 deletions(-)

New commits:
commit ce5c798868e33c094971d8b8c2c9f40afc8f21c3
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Tue Mar 11 15:42:49 2014 -0500

    force DPIScaleFactor to 1 on Mac
    
    Conflicts:
    	vcl/source/window/window.cxx
    
    Change-Id: I37629e1ef18f9843fcbdd643d8aaee0b3c8baa73
    Reviewed-on: https://gerrit.libreoffice.org/8560
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index f1cab66..f477b5c 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -983,7 +983,11 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste
     }
 
     // setup the scale factor for Hi-DPI displays
+#ifdef MACOSX
+    mnDPIScaleFactor = 1;
+#else
     mnDPIScaleFactor = std::max((sal_Int32)1, (mpWindowImpl->mpFrameData->mnDPIY + 48) / 96);
+#endif
 
     const StyleSettings& rStyleSettings = maSettings.GetStyleSettings();
     sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom();
@@ -1723,7 +1727,11 @@ void Window::ImplInitResolutionSettings()
         mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100;
 
         // setup the scale factor for Hi-DPI displays
-        mnDPIScaleFactor = std::max(1, (mpWindowImpl->mpFrameData->mnDPIY + 48) / 96);
+#ifdef MACOSX
+        mnDPIScaleFactor = 1;
+#else
+        mnDPIScaleFactor = std::max((sal_Int32)1, (mpWindowImpl->mpFrameData->mnDPIY + 48) / 96);
+#endif
 
         SetPointFont( rStyleSettings.GetAppFont() );
     }
commit a644b400d611bfa086e0cdb6b0a41228809ffd3d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 28 16:09:58 2014 +0000

    Related: fdo#73051 make font size drop down of optimal width
    
    presumably keithcu felt the font size was too wide, so lets
    try and implement the desired effect of an optimal width.
    
    Change-Id: Idc1741de04b3559fa415ebcf2289f96ba240ca8f
    Reviewed-on: https://gerrit.libreoffice.org/8520
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index c343844..ad99d66 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -53,6 +53,7 @@ public:
 
     void                statusChanged_Impl( long nHeight, bool bErase = false );
     void                UpdateFont( const ::com::sun::star::awt::FontDescriptor& rCurrentFont );
+    void                SetOptimalSize();
 
     virtual long        Notify( NotifyEvent& rNEvt );
 
@@ -85,12 +86,11 @@ SvxFontSizeBox_Impl::SvxFontSizeBox_Impl(
     FontSizeBox( _pParent, WinBits( WB_DROPDOWN ) ),
 
     m_pCtrl             ( &_rCtrl ),
-    m_aLogicalSize      ( 20,100 ),
+    m_aLogicalSize      ( 0,100 ),
     m_bRelease          ( true ),
     m_xDispatchProvider ( _rDispatchProvider ),
     m_xFrame            ( _xFrame )
 {
-    SetSizePixel( LogicToPixel( m_aLogicalSize, MAP_APPFONT ));
     SetValue( 0 );
     SetText( "" );
 }
@@ -221,6 +221,16 @@ long SvxFontSizeBox_Impl::Notify( NotifyEvent& rNEvt )
     return nHandled ? nHandled : FontSizeBox::Notify( rNEvt );
 }
 
+void SvxFontSizeBox_Impl::SetOptimalSize()
+{
+    Size aPrefSize(LogicToPixel(m_aLogicalSize, MAP_APPFONT));
+    aPrefSize.Width() = get_preferred_size().Width();
+    SetSizePixel(aPrefSize);
+    Size aDropSize(LogicToPixel(Size(0, LOGICAL_EDIT_HEIGHT), MAP_APPFONT));
+    aDropSize.Width() = aPrefSize.Width();
+    SetDropDownSizePixel(aDropSize);
+}
+
 // ---------------------------------------------------------------------------
 
 void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
@@ -228,9 +238,7 @@ void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
     {
-        SetSizePixel( LogicToPixel( m_aLogicalSize, MAP_APPFONT ));
-        Size aDropSize( m_aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT );
-        SetDropDownSizePixel( LogicToPixel( aDropSize, MAP_APPFONT ));
+        SetOptimalSize();
     }
 
     FontSizeBox::DataChanged( rDCEvt );
@@ -380,6 +388,10 @@ uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createItemWind
                         uno::Reference< frame::XDispatchProvider >( m_xFrame, uno::UNO_QUERY ),
                         m_xFrame,
                         *this );
+        //Get the box to fill itself with all its sizes
+        m_pBox->UpdateFont(m_aCurrentFont);
+        //Make it size itself to its optimal size re above sizes
+        m_pBox->SetOptimalSize();
         xItemWindow = VCLUnoHelper::GetInterface( m_pBox );
     }
 


More information about the Libreoffice-commits mailing list