[Libreoffice-commits] core.git: 3 commits - vcl/source

Maxim Monastirsky momonasmon at gmail.com
Wed Dec 21 09:49:27 UTC 2016


 vcl/source/window/dockmgr.cxx |   24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

New commits:
commit c95293de347597bb32d3c4aa5429b21385cae97a
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Wed Dec 21 04:42:34 2016 +0200

    Fix the table border toolbar popup
    
    Using ImplPopupFloatWin for it isn't a good idea:
    It doesn't need its dragging code, nor its painting code
    (which draws the ugly black border), and the resizing code
    conflicts with the title-based border which results in a
    wrong size (and we might have even bigger problems, if we
    start to use .ui based layouts for the ToolbarPopup class).
    We can of course put checks all over the place, but why do
    it, if we can simply use plain FloatingWindow?
    
    Change-Id: Ibc9a5c220309d15a60f6425835e1cc7a1b19c530

diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index fa6e3b8..ac587a6 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -435,8 +435,7 @@ private:
     void                        ImplSetBorder();
 
 public:
-    ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin,
-                       bool bHasGrip, bool bUsePopupWin );
+    ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip );
     virtual ~ImplPopupFloatWin() override;
     virtual void dispose() override;
 
@@ -456,16 +455,15 @@ public:
     bool                hasGrip() const { return mbHasGrip; }
 };
 
-ImplPopupFloatWin::ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin,
-        bool bHasGrip, bool bUsePopupWin ) :
-    FloatingWindow( pParent, bUsePopupWin ? WB_STDPOPUP : WB_NOBORDER | WB_SYSTEMWINDOW | WB_NOSHADOW)
+ImplPopupFloatWin::ImplPopupFloatWin( vcl::Window* pParent, ImplDockingWindowWrapper* pDockingWin, bool bHasGrip ) :
+    FloatingWindow( pParent, WB_NOBORDER | WB_SYSTEMWINDOW | WB_NOSHADOW )
 {
     mpWindowImpl->mbToolbarFloatingWindow = true;   // indicate window type, required for accessibility
                                                     // which should not see this window as a toplevel window
     mpDockingWin = pDockingWin;
     mbMoving = false;
     mbTrackingEnabled = false;
-    mbHasGrip = !bUsePopupWin && bHasGrip;
+    mbHasGrip = bHasGrip;
 
     ImplSetBorder();
 }
@@ -973,8 +971,11 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
     bool bIsToolBox = GetWindow()->GetType() == WINDOW_TOOLBOX;
 
     // the new parent for popup mode
-    VclPtrInstance<ImplPopupFloatWin> pWin( mpParent, this, bAllowTearOff,
-        bAllowTearOff && !bIsToolBox );
+    VclPtr<FloatingWindow> pWin;
+    if ( bAllowTearOff && !bIsToolBox )
+        pWin = VclPtr<FloatingWindow>::Create( mpParent, WB_STDPOPUP );
+    else
+        pWin = VclPtr<ImplPopupFloatWin>::Create( mpParent, this, bAllowTearOff );
     pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) );
     pWin->SetText( GetWindow()->GetText() );
 
@@ -987,7 +988,8 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
     GetWindow()->mpWindowImpl->mnBottomBorder  = 0;
 
     // position toolbox below the drag grip
-    GetWindow()->SetPosPixel( pWin->GetToolboxPosition() );
+    if ( bIsToolBox )
+        GetWindow()->SetPosPixel( static_cast<ImplPopupFloatWin*>( pWin.get() )->GetToolboxPosition() );
 
     // reparent borderwindow and window
     if ( mpOldBorderWin )
commit 90395eb694c0a9dd9033863d1def9678d4328943
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Wed Dec 21 04:08:23 2016 +0200

    Fix window height for the grip case
    
    Change-Id: I1a4d2c498971a5bf73dc7f89a0987e6f998cf7a6

diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index d3042ec..fa6e3b8 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -500,7 +500,7 @@ void ImplPopupFloatWin::ImplSetBorder()
     //  be used to set the proper window size
     mpWindowImpl->mnTopBorder     = 1;
     if( hasGrip() )
-        mpWindowImpl->mnTopBorder += 2 + ToolBox::ImplGetDragWidth( *this, false );
+        mpWindowImpl->mnTopBorder += 1 + ToolBox::ImplGetDragWidth( *this, false );
     mpWindowImpl->mnBottomBorder  = 1;
     mpWindowImpl->mnLeftBorder    = 1;
     mpWindowImpl->mnRightBorder   = 1;
commit 8f594cd9033b3020788feb30c0b1fd315b40119e
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Wed Dec 21 03:42:22 2016 +0200

    Fix the non-grip case
    
    Change-Id: Ic5b2d96829e5fc97004b3bba9cbb6ded2e27f22f

diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 65010f3..d3042ec 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -523,7 +523,7 @@ Rectangle ImplPopupFloatWin::GetDragRect() const
 Point ImplPopupFloatWin::GetToolboxPosition() const
 {
     // return inner position where a toolbox could be placed
-    return Point( 1, 1 + GetDragRect().getHeight() );    // grip + border
+    return Point( 1, 1 + ( hasGrip() ? GetDragRect().getHeight() : 0 ) );    // grip + border
 }
 
 void ImplPopupFloatWin::DrawBorder(vcl::RenderContext& rRenderContext)


More information about the Libreoffice-commits mailing list