* Finally finish implementing proper selection rect autoscroll to work with the

new asynchronous mouse tracking. Sorry for the delay. Up to now it was needing
mouse moves to autoscroll, it now behaves as before.

* Removed check that was disabling regular drag'n'drop auto-scrolling when
inactive. I don't see an obvious reason why that was done, as it's just handy
and is consistent with the other behaviors when inactive.

Note, i gotta love those comments that do anything but help, good example of
how not to comment :) i.e don't comment about what will happen when the
adjacent code won't be executed (especially in a case that can't happen).
My brain almost exploded a second time trying to explain that!

// selection scrolling will also work if the window is inactive
Should read:
// disable drag'n'drop auto scrolling when window is inactive




git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42447 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexandre Deckner 2011-07-17 17:28:29 +00:00
parent 9918b71672
commit def39abd74
2 changed files with 14 additions and 9 deletions

View File

@ -6579,6 +6579,11 @@ BPoseView::_BeginSelectionRect(const BPoint& point, bool shouldExtend)
fSelectionRectInfo.startPoint = point;
fSelectionRectInfo.lastPoint = point;
fSelectionRectInfo.isDragging = true;
if (fAutoScrollState == kAutoScrollOff) {
fAutoScrollState = kAutoScrollOn;
Window()->SetPulseRate(20000);
}
}
@ -6615,8 +6620,6 @@ BPoseView::_UpdateSelectionRect(const BPoint& point)
fIsDrawingSelectionRect = true;
CheckAutoScroll(point, true, true);
// use current selection rectangle to scan poses
if (ViewMode() == kListMode) {
SelectPosesListMode(fSelectionRectInfo.rect,
@ -9286,8 +9289,7 @@ BPoseView::HiliteDropTarget(bool hiliteState)
bool
BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll,
bool selectionScrolling)
BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll)
{
if (!fShouldAutoScroll)
return false;
@ -9297,10 +9299,6 @@ BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll,
if (window == NULL)
return false;
// selection scrolling will also work if the window is inactive
if (!selectionScrolling && !window->IsActive())
return false;
BRect bounds(Bounds());
BRect extent(Extent());
@ -9314,6 +9312,8 @@ BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll,
if (ViewMode() == kListMode)
border.top -= kTitleViewHeight;
bool selectionScrolling = fSelectionRectInfo.isDragging;
if (bounds.top > extent.top) {
if (selectionScrolling) {
keepGoing = mouseLoc.y < bounds.top;
@ -9419,6 +9419,11 @@ BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll,
}
}
// Force selection rect update to account for the new scrolled coords
// without a mouse move
if (selectionScrolling)
_UpdateSelectionRect(mouseLoc);
return wouldScroll;
}

View File

@ -592,7 +592,7 @@ class BPoseView : public BView {
// scrolling
void HandleAutoScroll();
bool CheckAutoScroll(BPoint mouseLoc, bool shouldScroll, bool selectionScrolling = false);
bool CheckAutoScroll(BPoint mouseLoc, bool shouldScroll);
// view extent handling
void RecalcExtent();