* Reworked my fix for #3617. We now check again for a double click if the pose
was not freshly selected. +alphabranch git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32660 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -126,7 +126,7 @@ BTextWidget::ColumnRect(BPoint poseLoc, const BColumn *column,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BRect
|
BRect
|
||||||
BTextWidget::CalcRectCommon(BPoint poseLoc, const BColumn *column,
|
BTextWidget::CalcRectCommon(BPoint poseLoc, const BColumn *column,
|
||||||
const BPoseView *view, float textWidth)
|
const BPoseView *view, float textWidth)
|
||||||
{
|
{
|
||||||
@@ -213,17 +213,54 @@ BTextWidget::CalcClickRect(BPoint poseLoc, const BColumn *column,
|
|||||||
void
|
void
|
||||||
BTextWidget::MouseUp(BRect bounds, BPoseView *view, BPose *pose, BPoint)
|
BTextWidget::MouseUp(BRect bounds, BPoseView *view, BPose *pose, BPoint)
|
||||||
{
|
{
|
||||||
// start editing if the duration between the pose selection time and
|
// Start editing without delay if the pose was selected recently and this
|
||||||
// the click on the widget is bigger than the doubleclick threshold.
|
// click is not the second click of a doubleclick.
|
||||||
|
// If the pose has been selected a long time ago, check again
|
||||||
|
// for a double click (inducing a delay).
|
||||||
|
|
||||||
|
// TODO: re-enable modifiers, one should be enough
|
||||||
|
|
||||||
if (IsEditable() && pose->IsSelected()) {
|
if (IsEditable() && pose->IsSelected()) {
|
||||||
bigtime_t delta = system_time() - pose->SelectionTime();
|
bigtime_t delta = system_time() - pose->SelectionTime();
|
||||||
bigtime_t doubleClickSpeed;
|
bigtime_t doubleClickSpeed;
|
||||||
get_click_speed(&doubleClickSpeed);
|
get_click_speed(&doubleClickSpeed);
|
||||||
|
bigtime_t oldClickSpeed = 2 * doubleClickSpeed;
|
||||||
// TODO: modifiers
|
|
||||||
if (delta > doubleClickSpeed)
|
// freshly selected and not a double click
|
||||||
|
if (delta > doubleClickSpeed && delta < oldClickSpeed) {
|
||||||
StartEdit(bounds, view, pose);
|
StartEdit(bounds, view, pose);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: reimplement asynchronous
|
||||||
|
// selected a longer time ago, redo a double click detection
|
||||||
|
if (delta > oldClickSpeed) {
|
||||||
|
// check for double click
|
||||||
|
bigtime_t doubleClickTime = system_time() + doubleClickSpeed;
|
||||||
|
while (system_time() < doubleClickTime) {
|
||||||
|
// loop for double-click time and watch the mouse and keyboard
|
||||||
|
|
||||||
|
BPoint point;
|
||||||
|
uint32 buttons;
|
||||||
|
view->GetMouse(&point, &buttons, false);
|
||||||
|
|
||||||
|
// double click
|
||||||
|
if (buttons)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// mouse moved too far
|
||||||
|
if (!bounds.Contains(point))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//if (modifiers() & (B_SHIFT_KEY | B_COMMAND_KEY
|
||||||
|
// | B_CONTROL_KEY | B_MENU_KEY))
|
||||||
|
// // watch the keyboard (ignoring standard locking keys)
|
||||||
|
// break;
|
||||||
|
|
||||||
|
snooze(10000);
|
||||||
|
}
|
||||||
|
StartEdit(bounds, view, pose);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +371,7 @@ BTextWidget::StartEdit(BRect bounds, BPoseView *view, BPose *pose)
|
|||||||
|
|
||||||
BScrollView *scrollView = new BScrollView("BorderView", textView, 0, 0, false,
|
BScrollView *scrollView = new BScrollView("BorderView", textView, 0, 0, false,
|
||||||
false, B_PLAIN_BORDER);
|
false, B_PLAIN_BORDER);
|
||||||
view->AddChild(scrollView);
|
view->AddChild(scrollView);
|
||||||
|
|
||||||
// configure text view
|
// configure text view
|
||||||
switch (view->ViewMode()) {
|
switch (view->ViewMode()) {
|
||||||
@@ -356,7 +393,7 @@ BTextWidget::StartEdit(BRect bounds, BPoseView *view, BPose *pose)
|
|||||||
SetActive(true); // for widget
|
SetActive(true); // for widget
|
||||||
|
|
||||||
textView->SelectAll();
|
textView->SelectAll();
|
||||||
textView->MakeFocus();
|
textView->MakeFocus();
|
||||||
|
|
||||||
// make this text widget invisible while we edit it
|
// make this text widget invisible while we edit it
|
||||||
SetVisible(false);
|
SetVisible(false);
|
||||||
@@ -456,7 +493,7 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView *view,
|
|||||||
// drawView->FillRect(eraseRect, B_SOLID_LOW);
|
// drawView->FillRect(eraseRect, B_SOLID_LOW);
|
||||||
drawView->FillRect(textRect, B_SOLID_LOW);
|
drawView->FillRect(textRect, B_SOLID_LOW);
|
||||||
} else
|
} else
|
||||||
drawView->SetDrawingMode(B_OP_OVER);
|
drawView->SetDrawingMode(B_OP_OVER);
|
||||||
|
|
||||||
// set high color
|
// set high color
|
||||||
rgb_color highColor;
|
rgb_color highColor;
|
||||||
@@ -537,7 +574,7 @@ BTextWidget::Draw(BRect eraseRect, BRect textRect, float, BPoseView *view,
|
|||||||
|
|
||||||
outlineColor.alpha = 200;
|
outlineColor.alpha = 200;
|
||||||
drawView->SetHighColor(outlineColor);
|
drawView->SetHighColor(outlineColor);
|
||||||
|
|
||||||
drawView->DrawString(fittingText, loc + BPoint(1, 1));
|
drawView->DrawString(fittingText, loc + BPoint(1, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user