[Libreoffice-commits] core.git: 5 commits - dbaccess/source svtools/source vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Thu May 28 02:57:07 PDT 2015


 dbaccess/source/ui/app/AppDetailView.cxx  |    6 ++-
 dbaccess/source/ui/app/AppTitleWindow.cxx |   40 +++++++++++++++-----
 dbaccess/source/ui/app/AppTitleWindow.hxx |    2 +
 svtools/source/contnr/imivctl1.cxx        |   58 +++++++++++++++++++-----------
 svtools/source/contnr/treelistbox.cxx     |   12 ++++--
 vcl/source/control/edit.cxx               |    2 -
 vcl/source/control/lstbox.cxx             |    2 -
 vcl/source/window/paint.cxx               |    7 +--
 8 files changed, 86 insertions(+), 43 deletions(-)

New commits:
commit 1afa39b1e9a4ce1cdab866a29a637283ed6792a9
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu May 28 18:53:13 2015 +0900

    fix calls to RenderContext
    
    Change-Id: I5ef4b740a9c62d5cc7a2126686df4fd86a4b3492

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 15cf93d..6ff15da 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -551,7 +551,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, bool bLayout)
         rRenderContext.DrawRect(Rectangle(aPos, Size(GetOutputSizePixel().Width() - 2 * mnXOffset, GetOutputSizePixel().Height())));
         rRenderContext.Pop();
 
-        SetTextFillColor(GetControlBackground());
+        rRenderContext.SetTextFillColor(GetControlBackground());
     }
     else if (IsPaintTransparent() || ImplUseNativeBorder(rRenderContext, GetStyle()))
         rRenderContext.SetTextFillColor();
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index a1ad0eb..6944518 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -555,7 +555,7 @@ void ListBox::DataChanged( const DataChangedEvent& rDCEvt )
         if ( mpImplWin )
         {
             mpImplWin->SetSettings( GetSettings() ); // If not yet set...
-            mpImplWin->ApplySettings(*this);
+            mpImplWin->ApplySettings(*mpImplWin);
 
             mpBtn->SetSettings( GetSettings() );
             ImplInitDropDownButton( mpBtn );
commit 737a0de6fd06070d5eb11c6dd43bb51f9cc272da
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu May 28 18:47:29 2015 +0900

    tdf#91649 call ApplySettings at a more correct place
    
    Change-Id: I84a620a845b9338cd830c8929346204e3d88003f

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index a68d6bc..fd50a20 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -217,6 +217,7 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion)
         {
             // double-buffering
             SetupBuffer();
+            m_pWindow->ApplySettings(*m_pBuffer.get());
 
             // temporarily decrease the mnOutOffX/Y of the buffer for the
             // subwidgets (because the m_pBuffer is our base here)
@@ -237,6 +238,7 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion)
         else
         {
             // direct painting
+            m_pWindow->ApplySettings(*m_pWindow);
             m_pWindow->PushPaintHelper(this, *m_pWindow);
             m_pWindow->Paint(*m_pWindow, m_aPaintRect);
         }
@@ -505,11 +507,6 @@ namespace vcl {
 
 void Window::ImplCallPaint(const VclPtr<VirtualDevice>& rBuffer, const vcl::Region* pRegion, sal_uInt16 nPaintFlags)
 {
-    if (rBuffer)
-        ApplySettings(*rBuffer.get());
-    else
-        ApplySettings(*this);
-
     // call PrePaint. PrePaint may add to the invalidate region as well as
     // other parameters used below.
     PrePaint(*this);
commit 8400e87a41b5613f2fcf27525b97b40f653a3178
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu May 28 18:43:55 2015 +0900

    fix highlight rendering for iconview with more effective clipping
    
    Change-Id: I9d8f2341477b9b9c0acd71a7d33cd5a9a55757d2

diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 51ba7a4..07221d5 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -663,13 +663,8 @@ void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const Rec
     if (!nCount)
         return;
 
-    bool bResetClipRegion = false;
-    if (!rRenderContext.IsClipRegion())
-    {
-        vcl::Region const aOutputArea(GetOutputRect());
-        bResetClipRegion = true;
-        rRenderContext.SetClipRegion(aOutputArea);
-    }
+    rRenderContext.Push(PushFlags::CLIPREGION);
+    rRenderContext.SetClipRegion(vcl::Region(rRect));
 
     SvxIconChoiceCtrlEntryList_impl* pNewZOrderList = new SvxIconChoiceCtrlEntryList_impl();
     boost::scoped_ptr<SvxIconChoiceCtrlEntryList_impl> pPaintedEntries(new SvxIconChoiceCtrlEntryList_impl());
@@ -701,15 +696,27 @@ void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const Rec
     }
     pPaintedEntries.reset();
 
-    if (bResetClipRegion)
-        rRenderContext.SetClipRegion();
+    rRenderContext.Pop();
 }
 
-void SvxIconChoiceCtrl_Impl::RepaintEntries(SvxIconViewFlags /*nEntryFlagsMask*/)
+void SvxIconChoiceCtrl_Impl::RepaintEntries(SvxIconViewFlags nEntryFlagsMask)
 {
-    pView->Invalidate();
-}
+    const size_t nCount = pZOrderList->size();
+    if (!nCount)
+        return;
 
+    Rectangle aOutRect(GetOutputRect());
+    for (size_t nCur = 0; nCur < nCount; nCur++)
+    {
+        SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[nCur];
+        if (pEntry->GetFlags() & nEntryFlagsMask)
+        {
+            const Rectangle& rBoundRect = GetEntryBoundRect(pEntry);
+            if (aOutRect.IsOver(rBoundRect))
+                pView->Invalidate(rBoundRect);
+        }
+    }
+}
 
 void SvxIconChoiceCtrl_Impl::InitScrollBarBox()
 {
@@ -1691,7 +1698,9 @@ void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po
         PaintEmphasis(aTextRect, aBmpRect, bSelected, bDropTarget, bCursored, rRenderContext, bIsBackgroundPainted);
 
     if ( bShowSelection )
-        pView->DrawSelectionBackground(CalcFocusRect(pEntry), bActiveSelection ? 1 : 2, false, true, false);
+        vcl::RenderTools::DrawSelectionBackground(rRenderContext, *pView.get(), CalcFocusRect(pEntry),
+                                                  bActiveSelection ? 1 : 2, false, true, false);
+
 
     PaintItem(aBmpRect, IcnViewFieldTypeImage, pEntry, nBmpPaintFlags, rRenderContext);
 
@@ -3575,12 +3584,20 @@ void SvxIconChoiceCtrl_Impl::SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEn
     if( !bKeepHighlightFlags )
         bHighlightFramePressed = false;
 
-    HideEntryHighlightFrame();
+    if (pCurHighlightFrame)
+    {
+        Rectangle aInvalidationRect(GetEntryBoundRect(pCurHighlightFrame));
+        aInvalidationRect.expand(5);
+        pCurHighlightFrame = nullptr;
+        pView->Invalidate(aInvalidationRect);
+    }
+
     pCurHighlightFrame = pEntry;
-    if( pEntry )
+    if (pEntry)
     {
-        Rectangle aBmpRect(CalcFocusRect(pEntry));
-        pView->Invalidate(aBmpRect);
+        Rectangle aInvalidationRect(GetEntryBoundRect(pEntry));
+        aInvalidationRect.expand(5);
+        pView->Invalidate(aInvalidationRect);
     }
 }
 
@@ -3590,9 +3607,10 @@ void SvxIconChoiceCtrl_Impl::HideEntryHighlightFrame()
         return;
 
     SvxIconChoiceCtrlEntry* pEntry = pCurHighlightFrame;
-    pCurHighlightFrame = 0;
-    Rectangle aBmpRect(CalcFocusRect(pEntry));
-    pView->Invalidate(aBmpRect);
+    pCurHighlightFrame = nullptr;
+    Rectangle aInvalidationRect(GetEntryBoundRect(pEntry));
+    aInvalidationRect.expand(5);
+    pView->Invalidate(aInvalidationRect);
 }
 
 void SvxIconChoiceCtrl_Impl::CallSelectHandler( SvxIconChoiceCtrlEntry* )
commit 02482eef0189e6c9f6ea233d495c9fd8a0d2a877
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Thu May 28 18:42:39 2015 +0900

    fix drawing treelistbox with redefined background in dbaccess
    
    Change-Id: Ia55797e3e42309f9d37d5335088f7657d99954de

diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index 0ae17bf..7329b0b 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -87,6 +87,8 @@ OCreationList::OCreationList( OTasksWindow& _rParent )
 
 void OCreationList::Paint(vcl::RenderContext& rRenderContext, const Rectangle& _rRect )
 {
+    SetBackground();
+
     if (m_pMouseDownEntry)
         m_aOriginalFont = rRenderContext.GetFont();
 
@@ -119,11 +121,13 @@ void OCreationList::PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListE
 
             // and temporary set a transparent background, for all the other
             // paint operations the SvTreeListBox is going to do
-            aEntryBackground = Wallpaper(Color(COL_TRANSPARENT));
+            aEntryBackground = Wallpaper();
+            _pEntry->SetBackColor(Color(COL_TRANSPARENT));
         }
     }
 
     rRenderContext.SetBackground(aEntryBackground);
+    _pEntry->SetBackColor(aEntryBackground.GetColor());
 }
 
 void OCreationList::SelectSearchEntry( const void* _pEntry )
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index abe9ad3..1ae2517 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -3043,10 +3043,14 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry, long nLine, vcl::Render
             // realize tab listboxes with lines.
             if (!(nCurTab == 0 && (nTreeFlags & SvTreeFlags::USESEL) && nFirstSelTab))
             {
-                rRenderContext.SetFillColor(aWallpaper.GetColor());
-                // this case may occur for smaller horizontal resizes
-                if (aRect.Left() < aRect.Right())
-                    rRenderContext.DrawRect(aRect);
+                Color aBackgroundColor = aWallpaper.GetColor();
+                if (aBackgroundColor != Color(COL_TRANSPARENT))
+                {
+                    rRenderContext.SetFillColor(aBackgroundColor);
+                    // this case may occur for smaller horizontal resizes
+                    if (aRect.Left() < aRect.Right())
+                        rRenderContext.DrawRect(aRect);
+                }
             }
             // draw item
             // center vertically
commit ee25bc3cad9f31a253c2a0b0297516c7f0989222
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed May 27 19:14:44 2015 +0900

    fix Base's titlewindow font, font color and background
    
    Change-Id: Ide9c30385d15d0b8303f25d1a9eef132a32ec7d2

diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx
index 1a28fb7..19da267 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.cxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.cxx
@@ -40,9 +40,17 @@ OTitleWindow::OTitleWindow(vcl::Window* _pParent,sal_uInt16 _nTitleId,WinBits _n
     SetBorderStyle(WindowBorderStyle::MONO);
     ImplInitSettings( true, true, true );
 
-    vcl::Window* pWindows [] = { m_aSpace1.get(), m_aSpace2.get(), m_aTitle.get() };
+    const StyleSettings& rStyle = Application::GetSettings().GetStyleSettings();
+    vcl::Window* pWindows[] = { m_aSpace1.get(), m_aSpace2.get(), m_aTitle.get() };
     for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
+    {
+        vcl::Font aFont = pWindows[i]->GetControlFont();
+        aFont.SetWeight(WEIGHT_BOLD);
+        pWindows[i]->SetControlFont(aFont);
+        pWindows[i]->SetControlForeground(rStyle.GetLightColor());
+        pWindows[i]->SetControlBackground(rStyle.GetShadowColor());
         pWindows[i]->Show();
+    }
 }
 
 OTitleWindow::~OTitleWindow()
@@ -158,18 +166,28 @@ void OTitleWindow::ImplInitSettings( bool bFont, bool bForeground, bool bBackgro
 
     if( bBackground )
         SetBackground( rStyleSettings.GetFieldColor() );
+}
 
-    vcl::Window* pWindows [] = { m_aSpace1.get(), m_aSpace2.get(), m_aTitle.get()};
-    for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
-    {
-        vcl::Font aFont = pWindows[i]->GetFont();
-        aFont.SetWeight(WEIGHT_BOLD);
-        pWindows[i]->SetFont(aFont);
-        pWindows[i]->SetTextColor( aStyle.GetLightColor() );
-        pWindows[i]->SetBackground( Wallpaper( aStyle.GetShadowColor() ) );
-    }
+void OTitleWindow::ApplySettings(vcl::RenderContext& rRenderContext)
+{
+    // FIXME RenderContext
+    AllSettings aAllSettings = rRenderContext.GetSettings();
+    StyleSettings aStyle = aAllSettings.GetStyleSettings();
+    aStyle.SetMonoColor(aStyle.GetActiveBorderColor());//GetMenuBorderColor());
+    aAllSettings.SetStyleSettings(aStyle);
+    rRenderContext.SetSettings(aAllSettings);
+
+    const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+    vcl::Font aFont;
+    aFont = rStyleSettings.GetFieldFont();
+    aFont.SetColor(rStyleSettings.GetWindowTextColor());
+    SetPointFont(*this, aFont);
+
+    rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor());
+    rRenderContext.SetTextFillColor();
+
+    rRenderContext.SetBackground(rStyleSettings.GetFieldColor());
 }
 
 } // namespace dbaui
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppTitleWindow.hxx b/dbaccess/source/ui/app/AppTitleWindow.hxx
index 875f693..888ec32 100644
--- a/dbaccess/source/ui/app/AppTitleWindow.hxx
+++ b/dbaccess/source/ui/app/AppTitleWindow.hxx
@@ -42,6 +42,8 @@ namespace dbaui
         virtual void Resize() SAL_OVERRIDE;
         virtual void GetFocus() SAL_OVERRIDE;
 
+        virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
+
         /** sets the child window which should be displayed below the title. It will be destroyed at the end.
             @param  _pChild
                 The child window.


More information about the Libreoffice-commits mailing list