[Libreoffice-commits] .: 2 commits - vcl/source

Ivan Timofeev ivantimofeev at kemper.freedesktop.org
Wed Jul 25 10:14:38 PDT 2012


 vcl/source/control/button.cxx |   32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

New commits:
commit ce53472216cab75bfdf04799fb85f375f01af792
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Wed Jul 25 20:53:37 2012 +0400

    changes to previous commit
    
    - bSize is not necessary
    - rename bInRect to aHotspotRect
    - rewrite the rectangle calculations
    - fix the x-coordinate of aStartPt
    
    Change-Id: Id474a3df5242423e5d4b6953af7e58ceeb50b810

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 2944abc..42579ac 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -825,7 +825,6 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, sal_uLong nDrawF
 {
     const StyleSettings&    rStyleSettings = GetSettings().GetStyleSettings();
     Rectangle               aInRect = rRect;
-    Rectangle               bInRect = rRect;
     Color                   aColor;
     XubString               aText = PushButton::GetText(); // PushButton:: wegen MoreButton
     sal_uInt16                  nTextStyle = ImplGetTextStyle( nDrawFlags );
@@ -854,7 +853,6 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, sal_uLong nDrawF
         nStyle = SYMBOL_DRAW_DISABLE;
 
     Size aSize = rRect.GetSize();
-    Size bSize = rRect.GetSize();
     Point aPos = rRect.TopLeft();
 
     sal_uLong nImageSep = 1 + (pDev->GetTextHeight()-10)/2;
@@ -862,21 +860,23 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, sal_uLong nDrawF
         nImageSep = 1;
     if ( mnDDStyle == PUSHBUTTON_DROPDOWN_MENUBUTTON )
     {
+        Rectangle aHotspotRect = rRect;
         if ( aText.Len() && ! (ImplGetButtonState() & BUTTON_DRAW_NOTEXT) )
         {
             // calculate symbol size
             long nSymbolSize    = pDev->GetTextHeight() / 2 + 1;
-            aInRect.Right()    -= 2; //rectangle width
-            aInRect.Left()      = aInRect.Right() - nSymbolSize;
 
-            //caluclate dimension of recent documents hotspot rectangle
+            // caluclate dimension of hotspot rectangle
+            aHotspotRect.Left() = aHotspotRect.Right() - 2*nSymbolSize;
 
-            bInRect.Right()    += 10; //rectangle width
-            bInRect.Left()      = bInRect.Right() - 3*nSymbolSize;
-            bSize.Width()      -= ( 5 + nSymbolSize );
-            ImplDrawAlignedImage( pDev, aPos, bSize, bLayout, nImageSep,
-                                  nDrawFlags, nTextStyle, NULL, true );
+            // center symbol rectangle inside hotspot rectangle
+            aInRect.Right() = aHotspotRect.Right() - nSymbolSize/2 + 1;
+            aInRect.Left()  = aInRect.Right() - nSymbolSize;
+
+            aSize.Width() -= aHotspotRect.GetWidth();
 
+            ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep,
+                                  nDrawFlags, nTextStyle, NULL, true );
         }
         else
             ImplCalcSymbolRect( aInRect );
@@ -887,15 +887,20 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, sal_uLong nDrawF
             DecorationView aDecoView( pDev );
             if( bMenuBtnSep )
             {
-                long nX = bInRect.Left() - 3*nDistance;
-                Point aStartPt( nX+10, bInRect.Top()+nDistance );
-                Point aEndPt( nX, bInRect.Bottom()-nDistance );
+                long nX = aHotspotRect.Left();
+                Point aStartPt( nX, aHotspotRect.Top()+nDistance );
+                Point aEndPt( nX, aHotspotRect.Bottom()-nDistance );
                 aDecoView.DrawSeparator( aStartPt, aEndPt );
             }
 
             aDecoView.DrawSymbol( aInRect, SYMBOL_SPIN_DOWN, aColor, nStyle );
-            bInRect.Left() -= -3*nDistance;
-            ImplSetSymbolRect( bInRect );
+
+            // hack: include decoration into hotspot rectangle (hopefully +10 is enough)
+            aHotspotRect.Right() += 10;
+            aHotspotRect.Bottom() += 10;
+            aHotspotRect.Top() -= 10;
+
+            ImplSetSymbolRect( aHotspotRect );
         }
 
     }
commit ad9ca11b6fa7792880571d33750c9f52568b837e
Author: Joel Madero <jmadero.dev at gmail.com>
Date:   Tue Jul 24 23:49:54 2012 -0700

    fdo#47164: Increased size of hotspot box for recent documents on Start Center
    
    Prior to patch hotspot and arrow symbol were being controlled by same
    rectangle feature. In order to increase hotspot area but leave arrow at
    the same size it was necessary to separate the two, creating a second
    rectangle to control hotspot size. New rectangle named bInRect, similarly
    bSize had to be created.
    
    Change-Id: Iec27d45e1f538dc0185861be7a988b0851fbb352

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 3dd6097..2944abc 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -825,6 +825,7 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, sal_uLong nDrawF
 {
     const StyleSettings&    rStyleSettings = GetSettings().GetStyleSettings();
     Rectangle               aInRect = rRect;
+    Rectangle               bInRect = rRect;
     Color                   aColor;
     XubString               aText = PushButton::GetText(); // PushButton:: wegen MoreButton
     sal_uInt16                  nTextStyle = ImplGetTextStyle( nDrawFlags );
@@ -853,6 +854,7 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, sal_uLong nDrawF
         nStyle = SYMBOL_DRAW_DISABLE;
 
     Size aSize = rRect.GetSize();
+    Size bSize = rRect.GetSize();
     Point aPos = rRect.TopLeft();
 
     sal_uLong nImageSep = 1 + (pDev->GetTextHeight()-10)/2;
@@ -862,14 +864,19 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, sal_uLong nDrawF
     {
         if ( aText.Len() && ! (ImplGetButtonState() & BUTTON_DRAW_NOTEXT) )
         {
-            // calc Symbol- and Textrect
+            // calculate symbol size
             long nSymbolSize    = pDev->GetTextHeight() / 2 + 1;
-            aInRect.Right()    -= 5;
+            aInRect.Right()    -= 2; //rectangle width
             aInRect.Left()      = aInRect.Right() - nSymbolSize;
-            aSize.Width()      -= ( 5 + nSymbolSize );
 
-            ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep,
+            //caluclate dimension of recent documents hotspot rectangle
+
+            bInRect.Right()    += 10; //rectangle width
+            bInRect.Left()      = bInRect.Right() - 3*nSymbolSize;
+            bSize.Width()      -= ( 5 + nSymbolSize );
+            ImplDrawAlignedImage( pDev, aPos, bSize, bLayout, nImageSep,
                                   nDrawFlags, nTextStyle, NULL, true );
+
         }
         else
             ImplCalcSymbolRect( aInRect );
@@ -880,15 +887,17 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, sal_uLong nDrawF
             DecorationView aDecoView( pDev );
             if( bMenuBtnSep )
             {
-                long nX = aInRect.Left() - 2*nDistance;
-                Point aStartPt( nX, aInRect.Top()+nDistance );
-                Point aEndPt( nX, aInRect.Bottom()-nDistance );
+                long nX = bInRect.Left() - 3*nDistance;
+                Point aStartPt( nX+10, bInRect.Top()+nDistance );
+                Point aEndPt( nX, bInRect.Bottom()-nDistance );
                 aDecoView.DrawSeparator( aStartPt, aEndPt );
             }
+
             aDecoView.DrawSymbol( aInRect, SYMBOL_SPIN_DOWN, aColor, nStyle );
-            aInRect.Left() -= 2*nDistance;
-            ImplSetSymbolRect( aInRect );
+            bInRect.Left() -= -3*nDistance;
+            ImplSetSymbolRect( bInRect );
         }
+
     }
     else
     {


More information about the Libreoffice-commits mailing list