Author: aldeck Date: 2011-07-17 19:28:29 +0200 (Sun, 17 Jul 2011) New Revision: 42447 Changeset: https://dev.haiku-os.org/changeset/42447 Modified: haiku/trunk/src/kits/tracker/PoseView.cpp haiku/trunk/src/kits/tracker/PoseView.h Log: * 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 Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2011-07-17 16:55:28 UTC (rev 42446) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2011-07-17 17:28:29 UTC (rev 42447) @@ -6579,6 +6579,11 @@ fSelectionRectInfo.startPoint = point; fSelectionRectInfo.lastPoint = point; fSelectionRectInfo.isDragging = true; + + if (fAutoScrollState == kAutoScrollOff) { + fAutoScrollState = kAutoScrollOn; + Window()->SetPulseRate(20000); + } } @@ -6615,8 +6620,6 @@ fIsDrawingSelectionRect = true; - CheckAutoScroll(point, true, true); - // use current selection rectangle to scan poses if (ViewMode() == kListMode) { SelectPosesListMode(fSelectionRectInfo.rect, @@ -9286,8 +9289,7 @@ bool -BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll, - bool selectionScrolling) +BPoseView::CheckAutoScroll(BPoint mouseLoc, bool shouldScroll) { if (!fShouldAutoScroll) return false; @@ -9297,10 +9299,6 @@ 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 @@ 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 @@ } } + // Force selection rect update to account for the new scrolled coords + // without a mouse move + if (selectionScrolling) + _UpdateSelectionRect(mouseLoc); + return wouldScroll; } Modified: haiku/trunk/src/kits/tracker/PoseView.h =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.h 2011-07-17 16:55:28 UTC (rev 42446) +++ haiku/trunk/src/kits/tracker/PoseView.h 2011-07-17 17:28:29 UTC (rev 42447) @@ -592,7 +592,7 @@ // scrolling void HandleAutoScroll(); - bool CheckAutoScroll(BPoint mouseLoc, bool shouldScroll, bool selectionScrolling = false); + bool CheckAutoScroll(BPoint mouseLoc, bool shouldScroll); // view extent handling void RecalcExtent();