Added working multi-word selection (asynchronous version)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13836 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2005-07-27 10:09:07 +00:00
parent f73ec094df
commit 148413eb24
+6 -12
View File
@@ -463,8 +463,6 @@ BTextView::MouseDown(BPoint where)
currentMessage->FindInt32("modifiers", &modifiers); currentMessage->FindInt32("modifiers", &modifiers);
bool shiftDown = modifiers & B_SHIFT_KEY; bool shiftDown = modifiers & B_SHIFT_KEY;
// TODO: Asynchronous mouse tracking
// should we initiate a drag? // should we initiate a drag?
if (fSelStart != fSelEnd && !shiftDown) { if (fSelStart != fSelEnd && !shiftDown) {
BPoint loc; BPoint loc;
@@ -504,6 +502,9 @@ BTextView::MouseDown(BPoint where)
// double click // double click
fClickCount = 2; fClickCount = 2;
fClickTime = system_time(); fClickTime = system_time();
int32 start, end;
FindWord(fClickOffset, &start, &end);
Select(start, end);
} }
} else { } else {
// new click // new click
@@ -521,9 +522,6 @@ BTextView::MouseDown(BPoint where)
if (!fSelectable) if (!fSelectable)
return; return;
// TODO: Honor window flags and skip this
// implementation even if we don't have an alternative
// asynchronous version, yet.
if (Window()->Flags() & B_ASYNCHRONOUS_CONTROLS) { if (Window()->Flags() & B_ASYNCHRONOUS_CONTROLS) {
SetMouseEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS, SetMouseEventMask(B_POINTER_EVENTS | B_KEYBOARD_EVENTS,
B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY); B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY);
@@ -3901,13 +3899,7 @@ BTextView::PerformMouseMoved(BPoint where, uint32 code)
int32 start = 0, end = 0; int32 start = 0, end = 0;
int32 offset = OffsetAt(where); int32 offset = OffsetAt(where);
int32 clickCount = 1; switch (fClickCount) {
#if 0
Window()->CurrentMessage()->FindInt32("clicks", &clickCount);
#endif
switch (clickCount) {
case 1: case 1:
start = min_c(offset, fClickOffset); start = min_c(offset, fClickOffset);
end = max_c(offset, fClickOffset); end = max_c(offset, fClickOffset);
@@ -3915,6 +3907,8 @@ BTextView::PerformMouseMoved(BPoint where, uint32 code)
case 2: case 2:
FindWord(offset, &start, &end); FindWord(offset, &start, &end);
start = min_c(start, fClickOffset);
end = max_c(end, fClickOffset);
break; break;
case 3: case 3: