From 879da8c81bd22487b7565f26da87502d7f25278f Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 12 Jun 2002 08:29:12 +0000 Subject: [PATCH] Applied recent FL patches from Benjamin Williams . 1) There is a problem in that floating frames are not currently supported with !mRealTimeUpdates. We wrote a patch to correct this problem. You will find it attached to this posting. Here is a description of what was changed and why. In cbBarDragPlugin::ShowHint(), SetBarState is called every time mpCurPane changes. This is correct. However, this also happens every time, even if mRealTimeUpdates is false. The state should not be changed during the drag operation if mRealTimeUpdates is off. This is corrected in this patch. Code was also added in cbBarDragPlugin::OnLButtonUp() to actually do the state changing, only if mRealTimeUpdates is off. Normally, this is performed in ShowHint if mRealTimeUpdates is on. I also took the liberty of changing the drag cursor back to an arrow. This is the way it is in MS Visual C++, and it looks way better. The MoveWindow cursor looks terrible, IMHO. When FL gets the embedded cursor code working, we can switch back to a hand or something else. 2) This time we have discovered a crash bug in FL. The steps to reproduce this bug are as follows: 1. Open up a pane, dock it. 2. Click the Expand button (arrow button) in the frame hints portion 3. Click it again to Collapse the pane. 4. Now click the close button of the pane. Crash. We investigated what was causing this problem, and it turns out that the button state never gets unset. Once a button is pressed, it is always pressed. Thus, when the expand/ collapse button is pressed, and then the close button is pressed, the pane will close, but then FL will also try to expand or collapse the pane as well, because it thinks that the expand/collapse button was set. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15802 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/src/fl/bardragpl.cpp | 59 +++++++++++++++++++++++++---------- contrib/src/fl/barhintspl.cpp | 5 +++ contrib/src/fl/toolwnd.cpp | 2 ++ 3 files changed, 50 insertions(+), 16 deletions(-) diff --git a/contrib/src/fl/bardragpl.cpp b/contrib/src/fl/bardragpl.cpp index 50ee1a43af..4e35ae422e 100644 --- a/contrib/src/fl/bardragpl.cpp +++ b/contrib/src/fl/bardragpl.cpp @@ -456,17 +456,6 @@ void cbBarDragPlugin::ShowHint( bool prevWasInClient ) { bool wasDocked = FALSE; - if ( mpDraggedBar->mState != wxCBAR_FLOATING && !mpCurPane ) - { - mpLayout->SetBarState( mpDraggedBar, wxCBAR_FLOATING, TRUE ); - } - else - if ( mpDraggedBar->mState == wxCBAR_FLOATING && mpCurPane ) - { - mpLayout->SetBarState( mpDraggedBar, wxCBAR_DOCKED_HORIZONTALLY, FALSE ); - - wasDocked = TRUE; - } if ( mpSrcPane->mProps.mRealTimeUpdatesOn == FALSE ) { @@ -510,6 +499,18 @@ void cbBarDragPlugin::ShowHint( bool prevWasInClient ) { // otherwise, if real-time updates option is ON + if ( mpDraggedBar->mState != wxCBAR_FLOATING && !mpCurPane ) + { + mpLayout->SetBarState( mpDraggedBar, wxCBAR_FLOATING, TRUE ); + } + else + if ( mpDraggedBar->mState == wxCBAR_FLOATING && mpCurPane ) + { + mpLayout->SetBarState( mpDraggedBar, wxCBAR_DOCKED_HORIZONTALLY, FALSE ); + + wasDocked = TRUE; + } + if ( mpCurPane ) { mpLayout->GetUpdatesManager().OnStartChanges(); @@ -641,16 +642,25 @@ void cbBarDragPlugin::OnMouseMove( cbMotionEvent& event ) wxCursor* pPrevCurs = mpCurCursor; if ( mpCurPane ) - - mpCurCursor = mpLayout->mpDragCursor; + { + mpCurCursor = mpLayout->mpNormalCursor; + } else { - if ( mpLayout->mFloatingOn && mpSrcPane->mProps.mRealTimeUpdatesOn ) + // if floating is off, and we are in the client + // area, the cursor will be invalid, otherwise + // it will be the normal cursor - mpCurCursor = mpLayout->mpDragCursor; + if (mpLayout->mFloatingOn) + { + mpCurCursor = mpLayout->mpNormalCursor; + } else + { mpCurCursor = mpLayout->mpNECursor; } + + } if ( pPrevCurs != mpCurCursor ) mpLayout->GetParentFrame().SetCursor( *mpCurCursor ); } @@ -687,9 +697,26 @@ void cbBarDragPlugin::OnLButtonUp( cbLeftUpEvent& event ) mpLayout->GetUpdatesManager().UpdateNow(); } else + { + if (mpDraggedBar->mState == wxCBAR_FLOATING) + { + mpLayout->SetBarState( mpDraggedBar, wxCBAR_DOCKED_HORIZONTALLY, TRUE); + } + mpLayout->RedockBar( mpDraggedBar, mHintRect, mpCurPane ); } } + else + { + if (mpDraggedBar->mState != wxCBAR_FLOATING) + { + mpLayout->SetBarState(mpDraggedBar, wxCBAR_FLOATING, true); + } + + mpDraggedBar->mDimInfo.mBounds[ wxCBAR_FLOATING ] = mHintRect; + mpLayout->ApplyBarProperties( mpDraggedBar ); + } + } mHintRect.width = -1; @@ -753,7 +780,7 @@ void cbBarDragPlugin::OnStartBarDragging( cbStartBarDraggingEvent& event ) mpLayout->CaptureEventsForPane( event.mpPane ); mpLayout->CaptureEventsForPlugin( this ); - mpLayout->GetParentFrame().SetCursor( *mpLayout->mpDragCursor ); + mpLayout->GetParentFrame().SetCursor( *mpLayout->mpNormalCursor ); mBarDragStarted = TRUE; diff --git a/contrib/src/fl/barhintspl.cpp b/contrib/src/fl/barhintspl.cpp index eb1f671685..241a98dea4 100644 --- a/contrib/src/fl/barhintspl.cpp +++ b/contrib/src/fl/barhintspl.cpp @@ -467,6 +467,11 @@ void cbBarHintsPlugin::OnLeftDown( cbLeftDownEvent& event ) { int i; for ( i = 0; i != BOXES_IN_HINT; ++i ) + { + mBoxes[i]->mPressed = FALSE; + mBoxes[i]->mWasClicked = FALSE; + } + for ( i = 0; i != BOXES_IN_HINT; ++i ) { mBoxes[i]->OnLeftDown( inFrame ); diff --git a/contrib/src/fl/toolwnd.cpp b/contrib/src/fl/toolwnd.cpp index a018ce3c5c..3f9824bf9f 100644 --- a/contrib/src/fl/toolwnd.cpp +++ b/contrib/src/fl/toolwnd.cpp @@ -571,6 +571,8 @@ void wxToolWindow::OnMotion( wxMouseEvent& event ) { DrawHintRect( mPrevHintRect ); DrawHintRect( finalRect ); + + ::wxLogTrace("%d,%d / %d,%d\n", finalRect.x, finalRect.y, finalRect.width, finalRect.height); } mPrevHintRect = finalRect; -- 2.47.2